Subject: | Enhancement Req - Harness::_show_results() option not to die on failure. |
The problem is die() is invoked if any test fails. I realize this is
what the design is meant to do.
I'm running Test::Harness in a perl script and want to processess the
output. I have STDERR and STDOUT redirected to a file but when a test
fails obviously the call to runtests() never returns and the script
exits. Therefore post-processing requires a separate script at this point.
Would it be possible to have _show_results() check for a package or
environmental variable that if set would call print() instead of die?
This would allow _show_results() to return to the caller (which I think
it should do anyway). Simple patch attached for what I'm using.
Using Perl 5.8.7. This is not OS or distribution specific.
Thanks,
David
Subject: | Harness_patch.txt |
514a515
> $ENV{HARNESS_VERSION} = $VERSION;
525c526,528
< die "FAILED--no tests were run for some reason.\n";
---
> die "FAILED--no tests were run for some reason.\n"
> if ( ! $ENV{HARNESS_DONT_DIE} );
> print "FAILED--no tests were run for some reason.\n";
528a532,533
> "alas--no output ever seen\n" if ( ! $ENV{HARNESS_DONT_DIE} );
> print "FAILED--$tot->{tests} test $blurb could be run, ".
547a553,554
> "$subpct\n" if ( ! $ENV{HARNESS_DONT_DIE} );
> print "Failed $tot->{bad}/$tot->{tests} test scripts, $pct% okay.".