Skip Menu |
 

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

Report information
The Basics
Id: 22080
Status: resolved
Priority: 0/
Queue: Test-Harness

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

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



Subject: false negative tests
Download (untitled) / with headers
text/plain 723b
example.t: #!/usr/bin/perl use Test::More tests => 2; ok(1 + 1 == 2); print "Test1"; is(1 + 1,2); test_harness.pl: #!/usr/bin/perl use Test::Harness qw(execute_tests); my @files = qw(example.t); my ($all,$failed,$todo) = execute_tests(tests => \@files); for my $script(keys %$failed){ print "In ",$script, " these tests failed: ", $failed->{$script}->{canon},"\n"; } Output: example....FAILED test 2 Failed 1/2 tests, 50.00% okay In example.t these tests failed: 2 If I add a "\n" to the print-statement it works fine: #!/usr/bin/perl use Test::More tests => 2; ok(1 + 1 == 2); print "Test1\n"; is(1 + 1,2); Output: harness_bsp....ok
Download (untitled) / with headers
text/plain 1.1k
On Fri Oct 13 07:59:35 2006, RENEEB wrote: Show quoted text
> example.t: > > #!/usr/bin/perl > use Test::More tests => 2; > ok(1 + 1 == 2); > print "Test1"; > is(1 + 1,2); > > > test_harness.pl: > > #!/usr/bin/perl > use Test::Harness qw(execute_tests); > > my @files = qw(example.t); > my ($all,$failed,$todo) = execute_tests(tests => \@files); > > for my $script(keys %$failed){ > print "In ",$script, > " these tests failed: ", > $failed->{$script}->{canon},"\n"; > } > > > > Output: > > example....FAILED test 2 > Failed 1/2 tests, 50.00% okay > In example.t these tests failed: 2 > > > If I add a "\n" to the print-statement it works fine: > #!/usr/bin/perl > use Test::More tests => 2; > ok(1 + 1 == 2); > print "Test1\n"; > is(1 + 1,2); > > > > Output: > > harness_bsp....ok
This is not a bug in Test::Harness. Your program output invalid TAP. 1..2 ok 1 Test1ok 2 Test::Harness is documented to simply ignore junk lines in its output. It might be argued that Test::More could do something to guard you against accidentally outputting junk, but I have no idea how that would work and anyway, that's Test::More's problem.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.