The main problem is that all modern test modules use Test :: Builder under the hood.
Test :: Builder itself assumes that you will have only one set of tests in the file.
Therefore, we need to reset singleton for each test suite ( Test::More->builder->reset ).
use strict; use warnings; use TAP::Harness; use Test::More; my %tests = ( a => sub{ plan tests => 4; ok 5==5, '5 == 5'; is 5, "5", 'is 5, 5'; like 5, qr'^\d$', '5 =~ /^\d$/'; is 5, 4, 'is 5, 4'; }, b => sub{ plan tests => 3; ok !0; ok !0; ok !0; }, c => sub{ plan 'no_plan'; ok !0; done_testing; }, d => sub{ ok !0; done_testing; }, ); sub runner{ my($harness,$test) = @_; my $builder = Test::More->builder;
a .. 1..4 ok 1 - 5 == 5 ok 2 - is 5, 5 ok 3 - 5 =~ /^\d$/ not ok 4 - is 5, 4 # Failed test 'is 5, 4' # at test.pl line 13. # got: '5' # expected: '4' Failed 1/4 subtests b .. 1..3 ok 1 ok 2 ok 3 ok c .. ok 1 1..1 ok d .. ok 1 1..1 ok Test Summary Report ------------------- a (Wstat: 0 Tests: 4 Failed: 1) Failed test: 4 Files=4, Tests=9, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: FAIL
source share