aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2023-12-12 10:30:12 +0900
committerYusuke Endoh <mame@ruby-lang.org>2023-12-12 10:31:37 +0900
commit207dcf07e1e1359ca87590c8c22867024f20ae03 (patch)
tree96ac102d90103ba5a070fdece0e710f8a38170f5 /test
parentcfb8494d5473b3695ac40aa6a9891284603bfc89 (diff)
downloadruby-207dcf07e1e1359ca87590c8c22867024f20ae03.tar.gz
Prevent a warning: method redefined
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index c274e333b1..8643bfaf95 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -642,6 +642,8 @@ WARN
assert_equal(42, obj.foo(42))
assert_equal(42, obj.foo(2, _: 0))
assert_equal(2, obj.foo(x: 2, _: 0))
+ ensure
+ self.class.remove_method(:foo)
end
def test_duplicated_opt_kw
@@ -1776,6 +1778,8 @@ eom
assert_warn(/`it`/) {eval('0.times { it; it = 1; it }')}
assert_no_warning(/`it`/) {eval('0.times { it = 1; it }')}
assert_no_warning(/`it`/) {eval('it = 1; 0.times { it }')}
+ ensure
+ self.class.remove_method(:foo)
end
def test_value_expr_in_condition