--- Geoffrey Young <[EMAIL PROTECTED]> wrote:
> we've discussed this a few times on this list, and I even submitted a
>
> patch to make it so:
>
> http://www.mail-archive.com/[email protected]/msg08973.html
>
> your interface is very nice, but I think I'd also like to preserve
> the
> ability to set it at will, outside of import.
>
> hopefully none of us will need to run patched versions for this
> feature
> at some point in the (near) future :)
Well, your feature is slightly different in that it calls BAIL_OUT on
failure and halts the entire test suite. It should be simple to add if
you wanted it, though, and a my custom Test::More uses documented
behavior rather than patching.
Your desire to add set the 'die on failure' behavior at will is great.
You can wrap the 'die' behavior like this:
sub die_on_failure {
wrap 'Test::Builder::ok', post => sub {
if (![ $_[0]->summary ]->[-1]) {
die "Test failed. Halting";
}
};
}
Then just add 'die_on_failure' to @EXPORT and modify import like this:
for my $i (0 .. $#_) {
if ('fail' eq $_[$i]) {
splice @_, $i, 1;
halt_on_failure();
last;
}
}
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Perl and CGI - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/