From a70bb8889b3130d72ec5a1f0ce92f386000a60da Mon Sep 17 00:00:00 2001 From: charliesome Date: Mon, 17 Dec 2012 09:49:00 +0000 Subject: * 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 --- test/ruby/test_class.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') 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 -- cgit v1.2.3