[ruby/pp] Suppress warnings in test on Ruby 2.7

TODO: Revert when dropping Ruby 2.7 support.

https://github.com/ruby/pp/commit/feb417e152
This commit is contained in:
Nobuyoshi Nakada 2025-10-05 10:25:23 +09:00
parent 252c253b75
commit 1dd11fe8c8
Notes: git 2025-10-05 12:00:47 +00:00

View File

@ -273,8 +273,21 @@ class PPSingleLineTest < Test::Unit::TestCase
def test_hash_in_array
omit if RUBY_ENGINE == "jruby"
assert_equal("[{}]", PP.singleline_pp([->(*a){a.last.clear}.ruby2_keywords.call(a: 1)], ''.dup))
assert_equal("[{}]", PP.singleline_pp([Hash.ruby2_keywords_hash({})], ''.dup))
assert_equal("[{}]", passing_keywords {PP.singleline_pp([->(*a){a.last.clear}.ruby2_keywords.call(a: 1)], ''.dup)})
assert_equal("[{}]", passing_keywords {PP.singleline_pp([Hash.ruby2_keywords_hash({})], ''.dup)})
end
if RUBY_VERSION >= "3.0"
def passing_keywords(&_)
yield
end
else
def passing_keywords(&_)
verbose, $VERBOSE = $VERBOSE, nil
yield
ensure
$VERBOSE = verbose
end
end
def test_direct_pp