diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_iterator.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index f3c2201e0a..38e795ee72 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -298,12 +298,19 @@ class TestIterator < Test::Unit::TestCase end def test_ljump - block = get_block{11} - lambda = lambda{44} assert_raises(LocalJumpError) {get_block{break}.call} - assert_nothing_raised {lambda{break}.call} - assert_instance_of(LocalJumpError, (get_block{break}.call rescue $!)) + # cannot use assert_nothing_raised due to passing block. + begin + val = lambda{break 11}.call + rescue LocalJumpError + assert(false, "LocalJumpError occurred from break in lambda") + else + assert(11, val) + end + + block = get_block{11} + lambda = lambda{44} assert_equal(-1, block.arity) assert_equal(-1, lambda.arity) assert_equal(0, lambda{||}.arity) |