Jim Weirich [mailto:jim / mail.one.net] wrote:

> Given the following unit tests ...
> 
> -- Unit Tests --------------------------------
> class TestOne < Test::Unit::TestCase
>   def test_ok
>     assert true, "this will pass"
>   end
> end
> 
> 
> class TestTwo < Test::Unit::TestCase
>   include UndefinedModule
> 
>   def test_also_ok
>     assert true, "This will be ignored"
>   end
> end
> -- END ---------------------------------------
> 
> Running them gives ...
> 
> -- UNIT TEST OUTPUT --------------------------
> traken$ ruby testbug.rb
> testbug.rb:13: uninitialized constant UndefinedModule at TestTwo
> (NameError)
> Loaded suite testbug
> Started
> ...
> Finished in 0.004499 seconds.
> 1 tests, 1 assertions, 0 failures, 0 errors
> -- END ---------------------------------------
> 
> Granted, there is a NameError in the output of the testcase, 
> but the final line (0 failures, 0 errors) gives no hint of that.
> 
> Is is possible for Unit::Test to trap that error and report 
> it in the summary line?  Or am I asking for the impossible?

I agree this is somewhat disconcerting, but I don't know of a good way
of fixing it. If there's a good, clean solution to trap errors like
this, then I'm all ears... otherwise, I don't think there's much I can
do. Sorry :-(


> BTW, great job on Test::Unit ... I use it ALL the time.

Thank you for evangelizing unit testing (I loved your test first
write-up a few days ago) - the world needs more unit testers :-)


Nathaniel

<:((><
+ - -
| RoleModel Software, Inc.
| EQUIP VI