Show quoted text> TAP::Harness has a 'stdout' parameter that lets you redirect stdout
to
Show quoted text> anything that looks like
> an IO handle.
I know that, but you can't capture everything with stdout...
A simple script that uses *::Harness (works with both TAP::Harness and
Test::Harness)
#!/usr/bin/perl
use strict;
use warnings;
use TAP::Harness;
use IO::Scalar;
my $var;
my $out = IO::Scalar->new( \$var );
my @tests = ('test2.pl');
my $harness = TAP::Harness->new({
verbosity => -2,
stdout => $out,
});
$harness->runtests( \@tests );
And a little test-script:
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 3;
is(1,1);
is(2,1);
die;
When I run the first script I still see this:
C:\>harness.pl
# Failed test at test2.pl line 9.
# got: '2'
# expected: '1'
Died at test2.pl line 10.
# Looks like you planned 3 tests but only ran 2.
# Looks like you failed 1 test of 2 run.
# Looks like your test died just after 2.
And I want to handle this output with an IO::Handle object or (at
least) suppress the output.