Skip Menu |

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

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

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

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



Message body is not shown because it is too large.

Attached is an additional failure report on Test-TAP-Model. This report was generated by my attempt to install Test-TAP-HTMLMatrix, for which Test-TAP-Model is a prerequisite. HTMLMatrix is a prerequisite for the the Parrot distro's 'make smoke' feature so, lacking it and its prerequisites, I am unable to send smoke reports on Parrot. Several other people at the Chicago Perl hackathon reported this failure.
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=darwin, osvers=8.7.0, archname=darwin-2level uname='darwin macintosh.local 8.7.0 darwin kernel version 8.7.0: fri may 26 15:20:53 pdt 2006; root:xnu-792.6.76.obj~1release_ppc power macintosh powerpc ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O3', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1495)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under darwin Compiled at Sep 13 2006 20:15:49 @INC: /usr/local/lib/perl5/5.8.8/darwin-2level /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl .

Message body is not shown because it is too large.

Here's a patch to fix things. I didn't patch Build.PL to require a recent version of Test::Harness, but this makes all of the tests pass on my system. For the curious, the problem is that Test::Harness::Straps now uses a Test::Harness::Results object instead of a raw hash reference.
diff -ur Test-TAP-Model-0.06/lib/Test/TAP/Model/File.pm Test-TAP-Model-0.06_new/lib/Test/TAP/Model/File.pm --- Test-TAP-Model-0.06/lib/Test/TAP/Model/File.pm 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/lib/Test/TAP/Model/File.pm 2006-12-08 22:57:35.000000000 -0800 @@ -28,9 +28,9 @@ } # predicates about the test file -sub ok { $_[0]{struct}{results}{passing} }; +sub ok { $_[0]{struct}{results}->passing() }; sub nok { !$_[0]->ok }; -sub skipped { exists $_[0]{struct}{results}{skip_all} }; +sub skipped { $_[0]{struct}{results}->skip_all() }; sub bailed_out { my $event = $_[0]{struct}{events}[-1] or return; return unless exists $event->{type}; @@ -45,7 +45,7 @@ sub _mk_objs { my $self = shift; wantarray ? map { $self->subtest_class->new($_) } @_ : @_ } sub _test_structs { my $self = shift; - my $max = $self->{struct}{results}{max}; + my $max = $self->{struct}{results}->max(); # cases is an array of *copies*... that's what the map is about my @cases = grep { exists $_->{type} and $_->{type} eq "test" } @{ $self->{struct}{events} }; @@ -82,18 +82,19 @@ } # queries about the test cases -sub planned { $_[0]{struct}{results}{max} }; +sub planned { $_[0]{struct}{results}->max() }; sub cases { - my @values = @{ $_[0]{struct}{results} }{qw/seen max/}; + my $results = $_[0]{struct}{results}; + my @values = $results->seen(), $results->max(); my $scalar = List::Util::max(@values); $_[0]->_c(sub { 1 }, $scalar) }; -sub actual_cases { $_[0]->_c(sub { $_->{line} ne "stub" }, $_[0]{struct}{results}{seen}) } -sub ok_tests { $_[0]->_c(sub { $_->{ok} }, $_[0]{struct}{results}{ok}) }; +sub actual_cases { $_[0]->_c(sub { $_->{line} ne "stub" }, $_[0]{struct}{results}->seen() ) } +sub ok_tests { $_[0]->_c(sub { $_->{ok} }, $_[0]{struct}{results}->ok() ) }; sub nok_tests { $_[0]->_c(sub { not $_->{ok} }, $_[0]->seen - $_[0]->ok_tests )}; -sub todo_tests { $_[0]->_c(sub { $_->{todo} }, $_[0]{struct}{results}{todo}) } -sub skipped_tests { $_[0]->_c(sub { $_->{skip} }, $_[0]{struct}{results}{skip}) } +sub todo_tests { $_[0]->_c(sub { $_->{todo} }, $_[0]{struct}{results}->todo() ) } +sub skipped_tests { $_[0]->_c(sub { $_->{skip} }, $_[0]{struct}{results}->skip() ) } sub unexpectedly_succeeded_tests { $_[0]->_c(sub { $_->{todo} and $_->{actual_ok} }) } sub ratio { diff -ur Test-TAP-Model-0.06/lib/Test/TAP/Model.pm Test-TAP-Model-0.06_new/lib/Test/TAP/Model.pm --- Test-TAP-Model-0.06/lib/Test/TAP/Model.pm 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/lib/Test/TAP/Model.pm 2006-12-08 23:00:34.000000000 -0800 @@ -31,7 +31,7 @@ sub _handle_test { my($self, $line, $type, $totals) = @_; - my $curr = $totals->{seen}||0; + my $curr = $totals->seen() || 0; # this is used by pugs' Test.pm, it's rather useful my $pos; @@ -40,7 +40,7 @@ $pos = $2; } - my %details = %{ $totals->{details}[-1] }; + my %details = %{ $totals->details()->[-1] }; $self->log_event( type => 'test', @@ -48,7 +48,7 @@ ok => $details{ok}, actual_ok => $details{actual_ok}, str => $details{ok} # string for people - ? "ok $curr/$totals->{max}" + ? "ok $curr/" . $totals->max() : "NOK $curr", todo => ($details{type} eq 'todo'), skip => ($details{type} eq 'skip'), @@ -169,8 +169,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; diff -ur Test-TAP-Model-0.06/t/basic.t Test-TAP-Model-0.06_new/t/basic.t --- Test-TAP-Model-0.06/t/basic.t 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/t/basic.t 2006-12-08 22:48:43.000000000 -0800 @@ -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"); diff -ur Test-TAP-Model-0.06/t/lib/StringHarness.pm Test-TAP-Model-0.06_new/t/lib/StringHarness.pm --- Test-TAP-Model-0.06/t/lib/StringHarness.pm 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/t/lib/StringHarness.pm 2006-12-08 22:55:45.000000000 -0800 @@ -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; diff -ur Test-TAP-Model-0.06/t/oop_file.t Test-TAP-Model-0.06_new/t/oop_file.t --- Test-TAP-Model-0.06/t/oop_file.t 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/t/oop_file.t 2006-12-08 23:08:11.000000000 -0800 @@ -6,10 +6,18 @@ # TODO not very comprehensive use Test::More tests => 16; +use Test::Harness::Results; my $m; BEGIN { use_ok($m = "Test::TAP::Model::File") } +my $r = Test::Harness::Results->new(); +$r->inc_max( 3 ); +$r->inc_seen() for 1 .. 12; +$r->inc_ok( 10 ); +$r->inc_todo() for 1 .. 11; +$r->inc_skip() for 1 .. 13; + isa_ok(my $f = $m->new(my $file = { events => [ my $ok_case = { @@ -21,24 +29,17 @@ ok => 0, }, ], - results => my $r = { - passing => 0, - ok => 10, - todo => 11, - max => 3, - seen => 12, - skip => 13, - } + results => $r, }), $m); ok(!$f->ok, "failed"); -$r->{passing} = 1; +$r->set_passing( 1 ); ok($f->ok, "passed"); is($f->passed, $f->ok, "alias"); is($f->failed, !$f->ok, "negation"); ok(!$f->skipped, "not all skipped"); -$r->{skip_all} = "reason"; +$r->set_skip_all( "reason" ); ok($f->skipped, "all skipped"); # demonstrates scalar context @@ -49,6 +50,6 @@ is($f->todo_tests, 11, "none are todo"); $nok_case->{todo} = 1; is($f->todo_tests, 11, "none are todo"); -$r->{todo} = 2; -is($f->todo_tests, 2, "two todo"); +$r->inc_todo(); +is($f->todo_tests, 12, "two todo"); is($f->skipped_tests, 13, "13 skipped"); diff -ur Test-TAP-Model-0.06/t/pos_guessing.t Test-TAP-Model-0.06_new/t/pos_guessing.t --- Test-TAP-Model-0.06/t/pos_guessing.t 2006-03-27 10:46:39.000000000 -0800 +++ Test-TAP-Model-0.06_new/t/pos_guessing.t 2006-12-08 22:51:11.000000000 -0800 @@ -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>
didn't notice this ticket, but fixed anyway in 0.07