Hi Michael, * Michael G Schwern <schw...@pobox.com> [2012-04-13 04:00]: > 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
yes. > If all you want is to bail out if the test fails to complete, that's > easy(er). That’s all AutoBailout does, it is just Ovid’s code packaged up as a tiny module. That is why I suggested shipping it with Test::More. I cannot imagine it ever causing a burden (though I’m fine with shipping it separately too). Just because it does so little, bordering on nothing. > I thought it was going to do something specifically when a `use` > fails, thus all the complexity. Well, does it need to? Test reports will contain STDERR anyway. All you lose is that the error message is a bit more raw. > 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 } I like that. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>