PATCH: added new Test::Unit compiler plugin

Doug Kearns djkea2 at mugca.its.monash.edu.au
Wed Apr 7 00:54:41 EDT 2004


On Thu, Apr 01, 2004 at 08:09:15PM +1000, Doug Kearns wrote:
> This is a first cut at compiler plugin for Test::Unit that I've had lying
> around for a long time - thought it might be an idea to commit it.
 
Any feedback on this would be appreciated.


require "test/unit"

class TestVimRubyUnitCompiler < Test::Unit::TestCase

  def test_assert_block()
    assert_block("block should have yielded true") {}
  end

  def test_assert_equal()
    assert_equal(1, 2, "1 should be equal to 2")
  end

  def test_assert_raise()
    assert_raise(Exception, "Exception should be raised") {}
  end
   
end


It is currently only trapping the user specified message as the efm
error message.
                                                                                                                              

:clist
2 rubyunit-test2.rb:8 error: 
5 rubyunit-test2.rb:12 error:  1 should be equal to 2
9 rubyunit-test2.rb:16 error:  Exception should be raised


However, the library generated message is available via,


:clist!
 1: 
 2 rubyunit-test2.rb:8 error: 
 3: block should have yielded true
 4: 
 5 rubyunit-test2.rb:12 error:  1 should be equal to 2
 6: <1> expected but was
 7: <2>.
 8: 
 9 rubyunit-test2.rb:16 error:  Exception should be raised
10: <Exception> exception expected but none was thrown.
11: 
12: 3 tests, 3 assertions, 3 failures, 0 errors


Does this seem logical?

Regards,
Doug


More information about the vim-ruby-devel mailing list