With the following example:
#---------------------------------------------------------
#!/usr/bin/ruby
require “test/unit”
class TestImplArchFile < Test::Unit::TestCase
def test_loop
[0,1,2].each do |i|
assert_equal(i, 6, "Duh, #{i} is not equal to 6.")
end
end
end
#---------------------------------------------------------
I get the following output:
#---------------------------------------------------------
Loaded suite ./t
Started
F
Finished in 0.00527 seconds.
- Failure:
test_loop(TestImplArchFile)
[./t.rb:10:intest_loop' ./t.rb:9:in
each’
./t.rb:9:in `test_loop’]:
Duh, 0 is not equal to 6.
<0> expected but was
<6>.
#---------------------------------------------------------
Is there any way I can see three errors, ie the exception
would create a failure, but not exit the def? I’d like to see
all errors in the loop. I’m not sure
#---------------------------------------------------------
-
Failure:
test_loop(TestImplArchFile)
[./t.rb:10:intest_loop' ./t.rb:9:in
each’
./t.rb:9:in `test_loop’]:
Duh, 0 is not equal to 6.
<0> expected but was
<6>. -
Failure:
test_loop(TestImplArchFile)
[./t.rb:10:intest_loop' ./t.rb:9:in
each’
./t.rb:9:in `test_loop’]:
Duh, 1 is not equal to 6.
<1> expected but was
<6>. -
Failure:
test_loop(TestImplArchFile)
[./t.rb:10:intest_loop' ./t.rb:9:in
each’
./t.rb:9:in `test_loop’]:
Duh, 2 is not equal to 6.
<2> expected but was
<6>.