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: 25294
Status: resolved
Priority: 0/
Queue: Test-Simple

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

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



Subject: Check $? before determining the exit code.
$ perl -wle 'use Test::More tests => 1; $SIG{__DIE__} = ""; pass; die' 1..1 ok 1 Died at -e line 1. $ echo $? 0 $ perl -wle 'use Test::More tests => 1; pass; die' 1..1 ok 1 Died at -e line 1. # Looks like your test died just after 1. $ echo $? 255 If the __DIE__ handler is deleted or overriden Test::More will think nothing died and set the $? to 0. This is bad. It should probably look at $? first. In fact, this might make the die handler unnecessary.
Subject: Test::Builder ate my exit status!
Initially reported and diagnosed at http://www.perlmonks.org/?node_id=645439. The following test program passes, but it shouldn't. #!/usr/bin/perl use strict; use warnings; use Test::More 'no_plan'; ok 1, 'this works'; $SIG{__DIE__} = sub { die @_ }; ok no_such_sub(), '... no such sub'; It passes with this output: Test-Harness-2.65_02 $ perl -Ilib bin/prove -v test.pl test....ok 1 - this works Undefined subroutine &main::no_such_sub called at test.pl line 9. 1..1 ok All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.22 cusr + 0.02 csys = 0.24 CPU) A bit of research suggests that &Test::Builder::_ending is eating the error code when that $SIG{__DIE__} line is encountered. Here's a counter example of a valid exit code (bash): $ perl -le '$SIG{__DIE__} = sub { die }; foo()'; echo $? Died at -e line 1. 255 Cheers, Ovid
0.76 will eliminate the Test::Builder die handler entirely which solves this problem.