I've been pondering custom test runners recently and have hit the
familiar problem of Test::Harness::Straps not capturing STDERR, so
missing the diagnostics that Test::Builder outputs.
A moderately evil solution occurred, and I now have a
Test::Builder::STDOUT on my box that just does:
use Test::Builder;
*Test::Builder::failure_output = \&Test::Builder::output;
redirecting all T::B diagnostic messages to STDOUT. Now I can add:
$ENV{ HARNESS_PERL_SWITCHES } = '-MTest::Builder::STDOUT';
to my test runner and all my diagnostics end up in the results hash
that Test::Harness::Straps::analyze_file returns.
Obviously won't work if your test scripts aren't written using T::B,
but that's not a problem I hit very often.
Greasy hack? Obviously - but it seems to do the job. I'm tempted to
throw it at CPAN :-)
Is there a better way I'm missing?
Cheers,
Adrian