From: Rafael Garcia-Suarez Date: Thu, 13 Sep 2007 09:10:18 +0000 (+0000) Subject: Better diagnostics and test naming X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec59cdf2d5626eaa3f168bc98399329d7b24bc2e;p=p5sagit%2Fp5-mst-13.2.git Better diagnostics and test naming p4raw-id: //depot/perl@31861 --- diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index ed14919..aeca025 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -40,8 +40,8 @@ ok($deparse); $/ = "\n####\n"; while () { chomp; - s/#(.*)$//mg; - my ($num) = $1 =~ m/(\d+)/; + s/#\s*(.*)$//mg; + my ($num, $testname) = $1 =~ m/(\d+)\s*(.*)/; my ($input, $expected); if (/(.*)\n>>>>\n(.*)/s) { ($input, $expected) = ($1, $2); @@ -53,7 +53,8 @@ while () { my $coderef = eval "sub {$input}"; if ($@) { - ok(0, "$num deparsed: $@"); + diag("$num deparsed: $@"); + ok(0, $testname); } else { my $deparsed = $deparse->coderef2text( $coderef ); @@ -61,7 +62,7 @@ while () { $regex =~ s/(\S+)/\Q$1/g; $regex =~ s/\s+/\\s+/g; $regex = '^\{\s*' . $regex . '\s*\}$'; - like($deparsed, qr/$regex/); + like($deparsed, qr/$regex/, $testname); } }