Subject: | Exceptions are swallowed when tests exceed count |
Date: | Thu, 31 Jan 2019 16:27:03 -0500 |
To: | bug-Test-Class [...] rt.cpan.org |
From: | Felipe Gasper <felipe [...] felipegasper.com> |
Sample script:
-----
package Test;
use Test::More;
plan tests => 1;
use parent qw( Test::Class );
sub mytest : Tests(1) {
ok 1;
ok 1;
die 123123;
}
__PACKAGE__->new()->runtests();
-----
Less contrived, what-actually-bit-me variant:
-----
#!/usr/bin/env perl
use strict;
use warnings;
sub new { bless [] }
sub throw { die '~~~~~~~~~~~~~~ threw' }
sub DESTROY { die 'DESTROYed' }
#----------------------------------------------------------------------
package Test;
use Test::More;
use Test::FailWarnings;
plan tests => 1;
use parent qw( Test::Class );
sub mytest : Tests(1) {
ok 1;
my $thing = main->new();
$thing->throw();
}
__PACKAGE__->new()->runtests();
-----
================
EASY FIX:
Take the _exception_failure(…) invocation from the $num_done == $num_expected case, and make that execute in the $num_done > $num_expected case as well.
Thank you!
-FG