mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* variable.c (rb_autoload_p): search superclasses as same as actual
loading. fixes [ruby-core:35679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d986500059
commit
af103c63dc
3 changed files with 27 additions and 1 deletions
|
@ -34,4 +34,22 @@ p Foo::Bar
|
|||
File.unlink(*tmpfiles) rescue nil if tmpfiles
|
||||
tmpdirs.each {|dir| Dir.rmdir(dir)}
|
||||
end
|
||||
|
||||
def test_autoload_p
|
||||
bug4565 = '[ruby-core:35679]'
|
||||
|
||||
require 'tmpdir'
|
||||
tmpdir = Dir.mktmpdir('autoload')
|
||||
tmpfile = tmpdir + '/foo.rb'
|
||||
a = Module.new do
|
||||
autoload :X, tmpfile
|
||||
end
|
||||
b = Module.new do
|
||||
include a
|
||||
end
|
||||
assert_equal(true, a.const_defined?(:X))
|
||||
assert_equal(true, b.const_defined?(:X))
|
||||
assert_equal(tmpfile, a.autoload?(:X), bug4565)
|
||||
assert_equal(tmpfile, b.autoload?(:X), bug4565)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue