aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 09:42:39 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-17 09:42:39 +0000
commit2b708b205b179b3c2036791bf68b3b5fa723a0e0 (patch)
tree43d4991042a8276b8e489ce0c7ef8efcf6762a0a /test/ruby/test_module.rb
parentc33ed20c18211183def75797efaa0f054ea5c9f4 (diff)
downloadruby-2b708b205b179b3c2036791bf68b3b5fa723a0e0.tar.gz
* method.h: introduce rb_method_definition_t::complemented_count.
* vm_method.c (method_definition_addref_complement): introduced. def->alias_count is used to decide warn or do not warn at method redefinition. Complented methods should not prevent redefiniton warnings. * vm_method.c (rb_method_definition_release): release def iff alias_count == 0 && complemented_count == 0. * test/ruby/test_module.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index dbbeca850d..b86efd7005 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1280,6 +1280,20 @@ class TestModule < Test::Unit::TestCase
undef foo
end
end
+
+ stderr = EnvUtil.verbose_warning do
+ Module.new do
+ def foo; end
+ mod = self
+ c = Class.new do
+ include mod
+ end
+ c.new.foo
+ def foo; end
+ end
+ end
+ assert_match(/: warning: method redefined; discarding old foo/, stderr)
+ assert_match(/: warning: previous definition of foo/, stderr)
end
def test_protected_singleton_method