Skip to content

Commit

Permalink
Prevent a warning: method redefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mame committed Dec 12, 2023
1 parent cfb8494 commit 207dcf0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/ruby/test_syntax.rb
Expand Up @@ -642,6 +642,8 @@ def test_duplicated_rest_kw
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
Expand Down Expand Up @@ -1776,6 +1778,8 @@ def test_it
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
Expand Down

0 comments on commit 207dcf0

Please sign in to comment.