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

add tests for "break" in lambda.

This commit is contained in:
Tanaka Akira 2019-07-15 12:59:53 +09:00
parent 8ac1c6eb48
commit bd494ae79b

View file

@ -157,6 +157,21 @@ class TestLambdaParameters < Test::Unit::TestCase
assert_equal(42, return_in_callee(42), feature8693)
end
def break_in_current(val)
1.tap(&->(*) {break 0})
val
end
def break_in_callee(val)
yield_block(&->(*) {break 0})
val
end
def test_break
assert_equal(42, break_in_current(42))
assert_equal(42, break_in_callee(42))
end
def test_do_lambda_source_location
exp_lineno = __LINE__ + 3
lmd = ->(x,