summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-11-23 17:32:01 +0000
committerDavid Mitchell <davem@iabyn.com>2015-11-23 17:52:00 +0000
commit1a7cb6482feeead144ca91eb5258ac811e6aa01e (patch)
tree339c644401557af11ecf60dac7972dc67a96a6dd
parent34c00cdfc34d79283a2b362c0e8f61762fb1c77d (diff)
downloadperl-1a7cb6482feeead144ca91eb5258ac811e6aa01e.tar.gz
Test.pm: avoid noise on STDERR.
If a TODO test fails, the diagnostic output should go to STDOUT rather than STDERR. This was originally https://rt.cpan.org/Public/Bug/Display.html?id=105423 but since Test has been moved from cpan/ to dist/, it can be applied locally.
-rw-r--r--dist/Test/lib/Test.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/dist/Test/lib/Test.pm b/dist/Test/lib/Test.pm
index cad2bcb2d4..de20922194 100644
--- a/dist/Test/lib/Test.pm
+++ b/dist/Test/lib/Test.pm
@@ -20,7 +20,7 @@ sub _reset_globals {
$planned = 0;
}
-$VERSION = '1.27';
+$VERSION = '1.28';
require Exporter;
@ISA=('Exporter');
@@ -461,23 +461,24 @@ sub _complain {
my $diag = $$detail{diagnostic};
$diag =~ s/\n/\n#/g if defined $diag;
+ my $out = $$detail{todo} ? $TESTOUT : $TESTERR;
$$detail{context} .= ' *TODO*' if $$detail{todo};
if (!$$detail{compare}) {
if (!$diag) {
- print $TESTERR "# Failed test $ntest in $$detail{context}\n";
+ print $out "# Failed test $ntest in $$detail{context}\n";
} else {
- print $TESTERR "# Failed test $ntest in $$detail{context}: $diag\n";
+ print $out "# Failed test $ntest in $$detail{context}: $diag\n";
}
} else {
my $prefix = "Test $ntest";
- print $TESTERR "# $prefix got: " . _quote($result) .
+ print $out "# $prefix got: " . _quote($result) .
" ($$detail{context})\n";
$prefix = ' ' x (length($prefix) - 5);
my $expected_quoted = (defined $$detail{regex})
? 'qr{'.($$detail{regex}).'}' : _quote($expected);
- print $TESTERR "# $prefix Expected: $expected_quoted",
+ print $out "# $prefix Expected: $expected_quoted",
$diag ? " ($diag)" : (), "\n";
_diff_complain( $result, $expected, $detail, $prefix )
@@ -485,7 +486,7 @@ sub _complain {
}
if(defined $Program_Lines{ $$detail{file} }[ $$detail{line} ]) {
- print $TESTERR
+ print $out
"# $$detail{file} line $$detail{line} is: $Program_Lines{ $$detail{file} }[ $$detail{line} ]\n"
if $Program_Lines{ $$detail{file} }[ $$detail{line} ]
=~ m/[^\s\#\(\)\{\}\[\]\;]/; # Otherwise it's uninformative