summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-30 04:15:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-30 04:15:46 +0000
commitfc664d40132ce5f621f83c3178e90b7b73a612e6 (patch)
tree93c3536ff19d3499e805a1e538e2f06694022fe5 /test
parent4634eee316267fc6c37ab425e37470d3d0d6539a (diff)
downloadruby-fc664d40132ce5f621f83c3178e90b7b73a612e6.tar.gz
ruby-fc664d40132ce5f621f83c3178e90b7b73a612e6.tar.xz
ruby-fc664d40132ce5f621f83c3178e90b7b73a612e6.zip
* vm_method.c (rb_add_method_def): show the location where
overwritten method was defined. [ruby-dev:39400] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_class.rb4
-rw-r--r--test/ruby/test_module.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 093448f2c..409fc49e4 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -106,6 +106,8 @@ class TestClass < Test::Unit::TestCase
end
def test_method_redefinition
+ feature2155 = '[ruby-dev:39400]'
+
line = __LINE__+4
stderr = EnvUtil.verbose_warning do
Class.new do
@@ -114,6 +116,7 @@ class TestClass < Test::Unit::TestCase
end
end
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
+ assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
stderr = EnvUtil.verbose_warning do
Class.new do
@@ -141,6 +144,7 @@ class TestClass < Test::Unit::TestCase
end
end
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
+ assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
stderr = EnvUtil.verbose_warning do
Class.new do
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index bfb347c46..c50cd38b7 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -788,6 +788,8 @@ class TestModule < Test::Unit::TestCase
end
def test_method_redefinition
+ feature2155 = '[ruby-dev:39400]'
+
line = __LINE__+4
stderr = EnvUtil.verbose_warning do
Module.new do
@@ -796,6 +798,7 @@ class TestModule < Test::Unit::TestCase
end
end
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
+ assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
stderr = EnvUtil.verbose_warning do
Module.new do
@@ -823,6 +826,7 @@ class TestModule < Test::Unit::TestCase
end
end
assert_match(/:#{line}: warning: method redefined; discarding old foo/, stderr)
+ assert_match(/:#{line-1}: warning: previous definition of foo/, stderr, feature2155)
stderr = EnvUtil.verbose_warning do
Module.new do