Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 553
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: richmond [...] wildfire.com
Cc:
AdminCc:

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



Subject: Test header seen twice!
Hi, When I try to use 'Test::More' instead of 'Test::Simple', the header '1..1' gets printed twice (at the beginning of the test and the end of the test). When I run the test with the Test::Harness, it complains about the extra header 'Test header seen twice!' and prints the name of the test being run twice. I've included two simple test scripts which I can use to reproduce the problem on my machine. I am using Test-Simple-0.44.tar.gz with Perl 5.6.1 under Red Hat 7.1. Has anyone else experienced this problem? Chris
Download test_cases.tar.gz
application/x-gzip 273b

Message body not shown because it is not plain text.

Subject: Need better guards against double plan.
[guest - Fri May 3 07:55:29 2002]: Show quoted text
> When I try to use 'Test::More' instead of 'Test::Simple', > the header '1..1' gets printed twice (at the beginning of > the test and the end of the test).
Your code is wrong. 'no_plan' is in and of itself a plan. "The plan is we have no plan". So by doing: #!/usr/bin/perl -w use Test::More qw(no_plan); $total_tests = 1; plan tests => $total_tests; you have made two plans. Test::More shouldn't have allowed that. The attached patch fixes. $ perl /tmp/test_more.pl You tried to plan twice! Second plan at /tmp/test_more.pl line 8 # No tests run!
Index: lib/Test/Builder.pm =================================================================== RCS file: /usr/local/cvsroot/Test-Simple/lib/Test/Builder.pm,v retrieving revision 1.22 diff -u -r1.22 Builder.pm --- lib/Test/Builder.pm 25 Apr 2002 04:28:20 -0000 1.22 +++ lib/Test/Builder.pm 3 May 2002 06:06:59 -0000 @@ -131,6 +131,11 @@ return unless $cmd; + if( $Have_Plan ) { + die sprintf "You tried to plan twice! Second plan at %s line %d\n", + ($self->caller)[1,2]; + } + if( $cmd eq 'no_plan' ) { $self->no_plan; }
From: richmond [...] wildfire.com
Doh! I didn't think 'no_plan' actually counted as a plan. Sorry to bother you. Chris [MSCHWERN - Fri May 3 10:50:30 2002]: Show quoted text
> [guest - Fri May 3 07:55:29 2002]:
> > When I try to use 'Test::More' instead of 'Test::Simple', > > the header '1..1' gets printed twice (at the beginning of > > the test and the end of the test).
> > Your code is wrong. 'no_plan' is in and of itself a plan. "The > plan is we have no plan". So by doing: > > #!/usr/bin/perl -w > > use Test::More qw(no_plan); > > $total_tests = 1; > > plan tests => $total_tests; > > you have made two plans. Test::More shouldn't have allowed that. > The attached patch fixes. > > $ perl /tmp/test_more.pl > You tried to plan twice! Second plan at /tmp/test_more.pl line 8 > # No tests run!
[guest - Fri May 3 10:59:01 2002]: Show quoted text
> Doh! > > I didn't think 'no_plan' actually counted > as a plan. > > Sorry to bother you.
Not at all! It was in my TODO list to disallow double plans.