1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* variable.c (rb_const_defined_0): fix autoloading base.

[ruby-core:35509]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-03-24 14:05:45 +00:00
parent e6a4a8018d
commit 0e3822c1e2
3 changed files with 24 additions and 1 deletions

View file

@ -85,4 +85,22 @@ class TestDefined < Test::Unit::TestCase
assert_equal 'global-variable', defined?($1)
assert_equal nil, defined?($2)
end
def test_autoloaded_subclass
bug = "[ruby-core:35509]"
klass = Class.new do
autoload(:A, "a")
end
x = klass.new
class << x
def a?; defined?(A); end
end
assert_equal("constant", x.a?, bug)
klass = Class.new(klass) do
def a?; defined?(A); end
end
assert_equal("constant", klass.new.a?, bug)
end
end