summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorcharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-17 09:49:00 +0000
committercharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-17 09:49:00 +0000
commita70bb8889b3130d72ec5a1f0ce92f386000a60da (patch)
tree4753f70eb20da004c9f294143593787f280c8cc6 /test/ruby
parent6d8ad6c489f41dfb5553d0933793eb5c84e0cc29 (diff)
* class.c (rewrite_cref_stack, clone_method): rewrite a method's cref
stack when cloning into a new class to allow lexical const lookup to work as expected [ruby-core:47834] [Bug #7107] * test/ruby/test_class.rb (class TestClass): related test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_class.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index e3047ccd5f..0ac29b3cf4 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -285,4 +285,18 @@ class TestClass < Test::Unit::TestCase
p A.superclass
RUBY
end
+
+ module M
+ C = 1
+
+ def self.m
+ C
+ end
+ end
+
+ def test_constant_access_from_method_in_cloned_module # [ruby-core:47834]
+ m = M.dup
+ assert_equal 1, m::C
+ assert_equal 1, m.m
+ end
end