From b512e61ca02ad5ebdfb08581e87bbc0791009684 Mon Sep 17 00:00:00 2001 From: charliesome Date: Sat, 8 Jun 2013 10:48:33 +0000 Subject: * 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/trunk@41175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_module.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/ruby/test_module.rb') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index fa7a408ede..816e5dc1ff 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1759,6 +1759,26 @@ class TestModule < Test::Unit::TestCase assert_raise(NoMethodError, bug8284) {Object.define_method} 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 + private def assert_top_method_is_private(method) -- cgit v1.2.3