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

* test/ruby/test_iterator.rb (test_ljump): cannot use

assert_nothing_raised due to passing block.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-03-02 02:28:44 +00:00
parent 4bea8f3ce2
commit 06953dceed
2 changed files with 18 additions and 6 deletions

View file

@ -298,12 +298,19 @@ class TestIterator < Test::Unit::TestCase
end
def test_ljump
assert_raises(LocalJumpError) {get_block{break}.call}
# 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_raises(LocalJumpError) {get_block{break}.call}
assert_nothing_raised {lambda{break}.call}
assert_instance_of(LocalJumpError, (get_block{break}.call rescue $!))
assert_equal(-1, block.arity)
assert_equal(-1, lambda.arity)
assert_equal(0, lambda{||}.arity)