Perl's Test::More doesn't seem to offer built-in way to say "bail out of just this test script, and continue with the next one".
You can exit() or die() but it doesn't give you very useful TAP output or prove output, just something like
t/foo.pl (Wstat: 256 Tests: 5 Failed: 0)
Non-zero exit status: 1
Parse errors: Bad plan. You planned 38 tests but ran 5.
which isn't super helpful.
If you BAIL_OUT("reason") you get more useful output, but all tests get aborted, not just the current test script.
Is there a sensible way to print a diagnostic message that'll be seen on prove's stderr and in the summary output when the harness exits, then jump to the next test script?
I grovelled through more of the Perl standard library than I ever wanted to to come up with this as my best option so far:
This will cause a test script that calls
BAIL_OUT("FOOBAR");to bail with something likethen
provestderr will show:and the summary will show
This is far from ideal, as the stderr and summary doesn't tell us what went wrong.
But it prevents the
BAIL_OUT()from nuking the rest of the run.One downside is that this won't help provide more info for tests that
die(). So I'm still looking for better options.