On 2012.4.11 1:01 PM, Aristotle Pagaltzis wrote: >> Unless I'm mistaken, Test::AutoBailOut is doing to need a global >> $SIG{__DIE__} handler or override CORE::require or add something to >> @INC or try to parse exception messages or something like that. Any >> of those have global side effects which can potentially interfere with >> or be overwritten by the code being tested. > > … what for? Is Ovid’s solution of just using an END block insufficient? > Why?
You're referring to this? http://www.nntp.perl.org/group/perl.qa/2012/04/msg13128.html If all you want is to bail out if the test fails to complete, that's easy(er). I thought it was going to do something specifically when a `use` fails, thus all the complexity. A general "bail out if this test file fails" function might be handy. An even more general "do X if the test finishes in Y state" would be even more handy. # There is no test_passed() END { BAIL_OUT() unless test_passed(); } I don't want to add a huge bunch of functions to Test::More to cover all the possible test states, in 1.5 you can get them from the TB2::History object. # This works in TB 1.5 END { BAIL_OUT() unless Test::More->builder->history->test_was_successful } Which is a bit of a mouthful. Providing a function to get at the history object would make a bunch of test state introspection easier. # That looks pretty good. END { BAIL_OUT() unless test_history->test_was_successful } -- Look at me talking when there's science to do. When I look out there it makes me glad I'm not you. I've experiments to be run. There is research to be done On the people who are still alive. -- Jonathan Coulton, "Still Alive"