Skip Menu |

This queue is for tickets about the Test-Legacy CPAN distribution.

Report information
The Basics
Id: 84606
Status: new
Priority: 0/
Queue: Test-Legacy

People
Owner: Nobody in particular
Requestors: colin.newell [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Test failures with TB1.5
There are various test failures with the new Test::Builder. Attached is a patch for those, the onfail.t modifications could do with review however. I've technically made the tests pass, but I wasn't sure whether that was a problematic difference in the way TB1.5 behaves, or just something we needed to avoid.
Subject: Test-Legacy-kludges.patch
diff -Naur Test-Legacy-1.2502/lib/Test/Legacy.pm Test-Legacy-Fix/lib/Test/Legacy.pm --- Test-Legacy-1.2502/lib/Test/Legacy.pm 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/lib/Test/Legacy.pm 2013-04-13 10:23:39.820461552 +0100 @@ -177,7 +177,14 @@ sub _is_failing { my $tb = shift; - return grep(!$_, $tb->summary) ? 1 : 0; + if($tb->can('history')) + { + return !$tb->history->can_succeed; + } + else + { + return grep(!$_, $tb->summary) ? 1 : 0; + } } sub _make_faildetail { diff -Naur Test-Legacy-1.2502/t/fail.t Test-Legacy-Fix/t/fail.t --- Test-Legacy-1.2502/t/fail.t 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/t/fail.t 2013-04-13 12:02:16.705801809 +0100 @@ -2,6 +2,7 @@ use strict; use vars qw($Expect); use Test::Legacy qw($TESTOUT $TESTERR $ntest ok skip plan); +use Test::Builder; plan tests => 14; # This test is very specific about what our output looks like. The @@ -58,8 +59,10 @@ sub commentless { my $in = $_[0]; + $in =~ s/^TAP version.*\n//mg; $in =~ s/^#[^\n]*\n//mg; $in =~ s/\n#[^\n]*$//mg; + $in =~ s/# SKIP ?/# skip/g; # kludge to deal with differing TAP versions return $in; } @@ -106,3 +109,10 @@ EXPECT } + +END { + # kludge to prevent new TB1.5 from firing an error + # on test failure. + Test::Builder->new->reset; + exit(0); +} diff -Naur Test-Legacy-1.2502/t/mix.t Test-Legacy-Fix/t/mix.t --- Test-Legacy-1.2502/t/mix.t 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/t/mix.t 2013-04-13 10:31:31.446800226 +0100 @@ -51,7 +51,9 @@ sub commentless { my $in = $_[0]; + $in =~ s/^TAP version.*\n//mg; $in =~ s/^#.*\n?//mg; + $in =~ s/# SKIP ?/# skip/g; # kludge to deal with differing TAP versions return $in; } diff -Naur Test-Legacy-1.2502/t/onfail.t Test-Legacy-Fix/t/onfail.t --- Test-Legacy-1.2502/t/onfail.t 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/t/onfail.t 2013-04-13 12:19:27.994915688 +0100 @@ -35,4 +35,5 @@ ok($$t{repetition}, 1); ok($$t{result}, 0); ok($$t{expected}, 1); + Test::Builder->new->reset; } diff -Naur Test-Legacy-1.2502/t/skip.t Test-Legacy-Fix/t/skip.t --- Test-Legacy-1.2502/t/skip.t 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/t/skip.t 2013-04-13 10:34:53.975804508 +0100 @@ -28,7 +28,10 @@ my @expect = split /\n+/, join('',<DATA>); ok @T, 4; for (my $x=0; $x < @T; $x++) { - ok $T[$x], $expect[$x]; + my $normalised = $T[$x]; + $normalised =~ s/SKIP/skip/; + $normalised =~ s/ $//; + ok $normalised, $expect[$x]; } END { close F; unlink "skips" } diff -Naur Test-Legacy-1.2502/t/todo.t Test-Legacy-Fix/t/todo.t --- Test-Legacy-1.2502/t/todo.t 2005-10-10 03:18:14.000000000 +0100 +++ Test-Legacy-Fix/t/todo.t 2013-04-13 10:26:55.745433093 +0100 @@ -51,6 +51,7 @@ sub commentless { my $in = $_[0]; + $in =~ s/^TAP version.*\n//mg; $in =~ s/^#[^\n]*\n//mg; $in =~ s/\n#[^\n]*$//mg; return $in;