Permalink
Browse files

regexp.t: print diagnostics with leading '#'

Some test platforms don't like unexpected output without the comment
prefix character
  • Loading branch information...
1 parent 6692294 commit 1b7228c9af61f2feb164874a11b82557fc988b5f Karl Williamson committed Sep 22, 2011
Showing with 8 additions and 3 deletions.
  1. +8 −3 t/re/regexp.t
View
11 t/re/regexp.t
@@ -59,6 +59,11 @@ BEGIN {
}
+sub _comment {
+ return map { /^#/ ? "$_\n" : "# $_\n" }
+ map { split /\n/ } @_;
+}
+
use strict;
use warnings FATAL=>"all";
use vars qw($iters $numtests $bang $ffff $nulnul $OP);
@@ -175,7 +180,7 @@ EOFCODE
next TEST;
}
elsif ($@) {
- print "not ok $test$todo $input => error `$err'\n$code\n$@\n"; next TEST;
+ print "not ok $test$todo $input => error `$err'\n", _comment("$code\n$@\n"); next TEST;
}
elsif ($result =~ /^n/) {
if ($match) { print "not ok $test$todo ($study) $input => false positive\n"; next TEST }
@@ -184,12 +189,12 @@ EOFCODE
if (!$match || $got ne $expect) {
eval { require Data::Dumper };
if ($@) {
- print "not ok $test$todo ($study) $input => `$got', match=$match\n$code\n";
+ print "not ok $test$todo ($study) $input => `$got', match=$match\n", _comment("$code\n");
}
else { # better diagnostics
my $s = Data::Dumper->new([$subject],['subject'])->Useqq(1)->Dump;
my $g = Data::Dumper->new([$got],['got'])->Useqq(1)->Dump;
- print "not ok $test$todo ($study) $input => `$got', match=$match\n$s\n$g\n$code\n";
+ print "not ok $test$todo ($study) $input => `$got', match=$match\n", _comment("$s\n$g\n$code\n");
}
next TEST;
}

0 comments on commit 1b7228c

Please sign in to comment.