From: Nathaniel Talbott Date: 2003-07-21T22:59:09+09:00 Subject: Re: testunit, exit status and at_exit Sean E. Russell [mailto:ser@germane-software.com] wrote: > On Monday 21 July 2003 00:08, Dave Thomas wrote: > > I'd really like TestUnit to be able to return an exit status when I > > run a test using > > Ditto, and I'll even provide a use case. > > If you have a software package that you make regular releases of, and a > semi-automated distribution mechanism, having an exit status on the unit > tests would allow the distribution mechanism to fail if any unit tests > failed. This would help avoid distributing broken releases, by making > testing on staging machines easier. I agree, too, but as Dave pointed out, my hands are tied at this point. I think Test::Unit has used (and abused) exit blocks a lot more than was perhaps ever intended (which, BTW, is Dave's fault in the first place - he gave me the idea :-). It does seem useful, though, to be able to set the exit status from an exit block. For your case, Sean, there is a work around: if($0 == __FILE__) exit(1) unless(Test::Unit::UI::Console::TestRunner.run(suite).passed?) end Unfortunately, in the current version under 1.8, it requires you to build the suite yourself. Under the version in /rough/lib/testunit, you could just do the following: exit(1) unless(Test::Unit::AutoRunner::run(__FILE__)) I may get it merged before the 1.8 release; if not, expect it for sure in 1.8.1. Nathaniel <:((><