aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-29 06:59:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-29 06:59:42 +0000
commit811c2d510066cc0b2021072b1e5c5853ce24a714 (patch)
tree722fdece7c9a88253adf8b9afc28bf1c21dd547e /test/ruby/test_module.rb
parente6fb96e691aae4d004fa9a492048365876f68d64 (diff)
downloadruby-811c2d510066cc0b2021072b1e5c5853ce24a714.tar.gz
* test/ruby/test_{class,module}.rb (test_method_redefinition): include
warned line number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 8829a3dcf1..bfb347c468 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -788,19 +788,47 @@ class TestModule < Test::Unit::TestCase
end
def test_method_redefinition
+ line = __LINE__+4
stderr = EnvUtil.verbose_warning do
Module.new do
def foo; end
def foo; end
end
end
- assert_match(/method redefined; discarding old foo/, stderr)
+ assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
stderr = EnvUtil.verbose_warning do
Module.new do
def foo; end
alias bar foo
+ def foo; end
+ end
+ end
+ assert_equal("", stderr)
+
+ stderr = EnvUtil.verbose_warning do
+ Module.new do
+ def foo; end
+ alias bar foo
+ alias bar foo
+ end
+ end
+ assert_equal("", stderr)
+
+ line = __LINE__+4
+ stderr = EnvUtil.verbose_warning do
+ Module.new do
+ define_method(:foo) do end
+ def foo; end
+ end
+ end
+ assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
+
+ stderr = EnvUtil.verbose_warning do
+ Module.new do
+ define_method(:foo) do end
alias bar foo
+ alias barf oo
end
end
assert_equal("", stderr)