diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-14 13:00:25 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-14 13:00:25 +0900 |
commit | 48edaf8b8a03ef7a1c4f936c8c92e9dcf4271872 (patch) | |
tree | caa55191b6854ef11ac25836ba7d4c2ef211fba4 | |
parent | 179062dd808c0a48e16269a2c42b10235cbbacd8 (diff) | |
download | ruby-48edaf8b8a03ef7a1c4f936c8c92e9dcf4271872.tar.gz |
test/ruby/test_proc.rb: suppress "method redefined" warnings
-rw-r--r-- | test/ruby/test_proc.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index f09e58e926..5c12043873 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -58,7 +58,10 @@ class TestProc < Test::Unit::TestCase b = assert_warn(/Capturing the given block using Proc\.new is deprecated/) do Proc.new end - meta.class_eval {define_method(:foo, b)} + meta.class_eval { + remove_method(:foo) if method_defined?(:foo) + define_method(:foo, b) + } assert_equal(n, method(:foo).arity) end |