diff options
author | Mark-Jason Dominus <mjd@plover.com> | 2002-04-01 20:32:18 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-01 20:16:46 +0000 |
commit | cf8feb78124b90756575c16fb087f9e129ee3a6d (patch) | |
tree | 74d27b299f9b8e90430294fe5b7672c140877304 /t/test.pl | |
parent | 75e258e97985e881c3ecf10011cdd639fc68778c (diff) | |
download | perl-cf8feb78124b90756575c16fb087f9e129ee3a6d.tar.gz |
Message-ID: <20020401203218.25230.qmail@plover.com>
p4raw-id: //depot/perl@15667
Diffstat (limited to 't/test.pl')
-rw-r--r-- | t/test.pl | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -30,8 +30,12 @@ END { # Use this instead of "print STDERR" when outputing failure diagnostic # messages sub _diag { + return unless @_; + my @mess = map { /^#/ ? "$_\n" : "# $_\n" } + map { split /\n/ } @_; my $fh = $TODO ? *STDOUT : *STDERR; - print $fh @_; + print $fh @mess; + } sub skip_all { @@ -64,8 +68,7 @@ sub _ok { } # Ensure that the message is properly escaped. - _diag map { /^#/ ? "$_\n" : "# $_\n" } - map { split /\n/ } @mess if @mess; + _diag @mess; $test++; @@ -241,11 +244,12 @@ sub fail { } sub curr_test { + $test = shift if @_; return $test; } sub next_test { - $test++ + $test++; } # Note: can't pass multipart messages since we try to @@ -512,10 +516,10 @@ sub _fresh_perl { my $pass = $resolve->($results); unless ($pass) { - print STDERR "# PROG: $switch\n$prog\n"; - print STDERR "# EXPECTED:\n", $resolve->(), "\n"; - print STDERR "# GOT:\n$results\n"; - print STDERR "# STATUS: $status\n"; + _diag "# PROG: \n$prog\n"; + _diag "# EXPECTED:\n", $resolve->(), "\n"; + _diag "# GOT:\n$results\n"; + _diag "# STATUS: $status\n"; } # Use the first line of the program as a name if none was given |