From: Karl Williamson Date: Thu, 22 Sep 2011 23:34:35 +0000 (-0600) Subject: regexp.t: print diagnostics with leading '#' X-Git-Tag: v5.15.4~260 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/1b7228c9af61f2feb164874a11b82557fc988b5f regexp.t: print diagnostics with leading '#' Some test platforms don't like unexpected output without the comment prefix character --- diff --git a/t/re/regexp.t b/t/re/regexp.t index 9c430ad..815b877 100644 --- a/t/re/regexp.t +++ b/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; }