1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/ruby/test_lambda.rb: prevent lambda(&proc_block) warnings

This commit is contained in:
Yusuke Endoh 2020-12-12 23:11:47 +09:00
parent 248f1ef282
commit efbef729b2

View file

@ -83,15 +83,21 @@ class TestLambdaParameters < Test::Unit::TestCase
end
def test_create_non_lambda_for_proc_one_level
prev_warning, Warning[:deprecated] = Warning[:deprecated], false
f = pass_along {}
refute_predicate(f, :lambda?, '[Bug #15620]')
assert_nothing_raised(ArgumentError) { f.call(:extra_arg) }
ensure
Warning[:deprecated] = prev_warning
end
def test_create_non_lambda_for_proc_two_levels
prev_warning, Warning[:deprecated] = Warning[:deprecated], false
f = pass_along2 {}
refute_predicate(f, :lambda?, '[Bug #15620]')
assert_nothing_raised(ArgumentError) { f.call(:extra_arg) }
ensure
Warning[:deprecated] = prev_warning
end
def test_instance_exec