Skip Menu |

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

Report information
The Basics
Id: 24053
Status: resolved
Priority: 0/
Queue: Test-TAP-Model

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

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



Subject: Test::Harness 2.64 changed analyze_* interface
Test::Harness 2.64 changed the interface of the analyze methods in Test::Harness::Straps. They now return objects, not a hash. Additionally the objects don't fill in the blanks like the hash did so some things come out as undef instead of 0. The following patch changes Test::TAP::Model to use the new interface, as its experimental its best to chase the newest versions rather than try to deal with older ones. I did not change it to use the new Results object, it still treats it like a hash. I believe the other bug in this queue does that.
Subject: TH.patch
Auto-merging (0, 26462) /local/Test-TAP-Model to /vendor/Test-TAP-Model (base /vendor/Test-TAP-Model:26459). U t/basic.t U t/lib/StringHarness.pm U t/pos_guessing.t U lib/Test/TAP/Model/File.pm U lib/Test/TAP/Model.pm U Build.PL ==== Patch <-> level 1 Source: 9c88509d-e914-0410-b01c-b9530614cbfe:/local/Test-TAP-Model:26462 Target: 9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/Test-TAP-Model:26459 Log: r26460@windhund: schwern | 2006-12-22 10:51:19 -0500 Local branch of Test-TAP-Model r26461@windhund: schwern | 2006-12-22 11:11:16 -0500 Test::Harness::Straps changed its interface in Test-Harness 2.64 so that the analyze_* methods return a results object rather than a hash. r26462@windhund: schwern | 2006-12-22 11:19:55 -0500 Test::Harness::Straps in TH 2.64 doesn't seem to initialize its results quite as much as it used to. This resulted in some undefs where 0 was expected. === t/basic.t ================================================================== --- t/basic.t (revision 26459) +++ t/basic.t (patch - level 1) @@ -15,7 +15,7 @@ can_ok($t, "start_file"); my $e = $t->start_file("example"); -$e->{results} = { $t->analyze_fh("example", \*DATA) }; +$e->{results} = $t->analyze_fh("example", \*DATA); isa_ok(my $s = $t->structure, "HASH"); === t/lib/StringHarness.pm ================================================================== --- t/lib/StringHarness.pm (revision 26459) +++ t/lib/StringHarness.pm (patch - level 1) @@ -17,7 +17,7 @@ $output = [split /\n/,$output]; my $r = $s->start_file($name); - eval { $r->{results} = { $s->analyze($name, $output) } }; + eval { $r->{results} = $s->analyze($name, $output) }; } return $s; === t/pos_guessing.t ================================================================== --- t/pos_guessing.t (revision 26459) +++ t/pos_guessing.t (patch - level 1) @@ -11,7 +11,7 @@ isa_ok(my $s = $m->new, $m); my $f = $s->start_file("foo"); -eval { $f->{results} = { $s->analyze("foo", [split /\n/, <<TAP]) } }; +eval { $f->{results} = $s->analyze("foo", [split /\n/, <<TAP]) }; 1..3 ok 1 foo <pos:foo.t at line 2, column 1> ok 2 foo <pos:file "gorch" line 4> === lib/Test/TAP/Model/File.pm ================================================================== --- lib/Test/TAP/Model/File.pm (revision 26459) +++ lib/Test/TAP/Model/File.pm (patch - level 1) @@ -82,11 +82,11 @@ } # queries about the test cases -sub planned { $_[0]{struct}{results}{max} }; +sub planned { $_[0]{struct}{results}{max} || 0 }; sub cases { my @values = @{ $_[0]{struct}{results} }{qw/seen max/}; - my $scalar = List::Util::max(@values); + my $scalar = List::Util::max( map { $_ || 0 } @values); $_[0]->_c(sub { 1 }, $scalar) }; sub actual_cases { $_[0]->_c(sub { $_->{line} ne "stub" }, $_[0]{struct}{results}{seen}) } === lib/Test/TAP/Model.pm ================================================================== --- lib/Test/TAP/Model.pm (revision 26459) +++ lib/Test/TAP/Model.pm (patch - level 1) @@ -42,13 +42,14 @@ my %details = %{ $totals->{details}[-1] }; + my $max = $totals->{max} || 0; $self->log_event( type => 'test', num => $curr, ok => $details{ok}, actual_ok => $details{actual_ok}, str => $details{ok} # string for people - ? "ok $curr/$totals->{max}" + ? "ok $curr/$max" : "NOK $curr", todo => ($details{type} eq 'todo'), skip => ($details{type} eq 'skip'), @@ -169,8 +170,8 @@ my $test_file = $self->start_file($file); - my %results = eval { $self->analyze_file($file) }; - $test_file->{results} = \%results; + my $results = eval { $self->analyze_file($file) }; + $test_file->{results} = $results; delete $test_file->{results}{details}; $test_file; @@ -321,7 +322,7 @@ pre_diag => # diagnosis emitted before any test }; - %results = $strap->analyze_foo(); + $results = $strap->analyze_foo(); $events = [ { === Build.PL ================================================================== --- Build.PL (revision 26459) +++ Build.PL (patch - level 1) @@ -9,6 +9,7 @@ license => 'perl', requires => { 'perl' => '5.8', + 'Test::Harness' => '2.64' }, build_requires => { 'Test::More' => "0.53",
Fixed in 0.08.