Skip to content

Commit feb417e

Browse files
committed
Suppress warnings in test on Ruby 2.7
TODO: Revert when dropping Ruby 2.7 support.
1 parent 0e89466 commit feb417e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/test_pp.rb

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,21 @@ def test_hash_symbol_colon_key
273273

274274
def test_hash_in_array
275275
omit if RUBY_ENGINE == "jruby"
276-
assert_equal("[{}]", PP.singleline_pp([->(*a){a.last.clear}.ruby2_keywords.call(a: 1)], ''.dup))
277-
assert_equal("[{}]", PP.singleline_pp([Hash.ruby2_keywords_hash({})], ''.dup))
276+
assert_equal("[{}]", passing_keywords {PP.singleline_pp([->(*a){a.last.clear}.ruby2_keywords.call(a: 1)], ''.dup)})
277+
assert_equal("[{}]", passing_keywords {PP.singleline_pp([Hash.ruby2_keywords_hash({})], ''.dup)})
278+
end
279+
280+
if RUBY_VERSION >= "3.0"
281+
def passing_keywords(&_)
282+
yield
283+
end
284+
else
285+
def passing_keywords(&_)
286+
verbose, $VERBOSE = $VERBOSE, nil
287+
yield
288+
ensure
289+
$VERBOSE = verbose
290+
end
278291
end
279292

280293
def test_direct_pp

0 commit comments

Comments
 (0)