summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-24 14:05:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-03-24 14:05:45 +0000
commit0e3822c1e2e81baa96793e881cbbdfc2db7aba3a (patch)
tree9ae25a4feecf5ac73e5668c84b922180d0aad91a /test
parente6a4a8018d1fd070cae7db533840aaa0dbcbe8ec (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_defined.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index 9d52e04bc0..e1d685275d 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -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