Yotta Meter wrote:
> Is there any way I can see three errors, ie the exception
> would create a failure, but not exit the def?

No, I don't think so. A failed assertion raises AssertionFailedError 
which terminates your method. There are no restarts in Ruby.

You can accumulate the errors yourself:

  errs = []
  [0,1,2].each do |i|
    errs << "Duh, #{i} is not equal to 6" unless i == 6
  end
  assert errs.empty?, errs.join("; ")

You can use a bit of metaprogramming to create three separate test 
methods in a loop.

  require 'test/unit'
  class TestBase < Test::Unit::TestCase
    (0..2).each do |i|
      define_method("test_loop#{i}") do
        assert_equal 6, i, "Duh, #{i} is not equal to 6."
      end
    end
  end

Or for fun, even three separate test classes:

  require 'test/unit'
  class TestBase < Test::Unit::TestCase
    CHECK = 0
    def test_it
      assert_equal 6, self.class::CHECK, "Duh, #{self.class::CHECK} != 
6"
    end
  end

  klasses = []
  (1..2).each do |n|
    klass = Class.new(TestBase)
    klass.const_set(:CHECK, n)
    klasses << klass  # for GC
  end

That's not very pretty though.
-- 
Posted via http://www.ruby-forum.com/.