aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
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