summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 07:26:49 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-26 07:26:49 +0000
commita43b8412ea13b43cdd65177ed75ac76001ec8734 (patch)
tree096f161fb31aa64ecece1483ab65301c1078927d /test
parentfbc47099df8f311c7de999f7feb1279e57961c1e (diff)
merge revision(s) 41175: [Backport #8503]
* class.c (include_modules_at): invalidate method cache if included module contains constants * test/ruby/test_module.rb: add test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@41645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_module.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 6176f484bc..6673852d9c 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1220,4 +1220,24 @@ class TestModule < Test::Unit::TestCase
INPUT
assert_in_out_err([], src, ["NameError"], [])
end
+
+ def test_include_module_with_constants_invalidates_method_cache
+ assert_in_out_err([], <<-RUBY, %w(123 456), [])
+ A = 123
+
+ class Foo
+ def self.a
+ A
+ end
+ end
+
+ module M
+ A = 456
+ end
+
+ puts Foo.a
+ Foo.send(:include, M)
+ puts Foo.a
+ RUBY
+ end
end