Skip to content

Instantly share code, notes, and snippets.

@petdance
Created May 17, 2016 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petdance/361d938bad7283cd41df59560da7f5ea to your computer and use it in GitHub Desktop.
Save petdance/361d938bad7283cd41df59560da7f5ea to your computer and use it in GitHub Desktop.
$ cat foo.t
#!/var/perl/bin/perl
use strict;
use warnings;
use 5.010;
use Test::Tester;
use Test::More tests => 15;
sub bongo {
local $Test::Builder::Level = $Test::Builder::Level + 1;
#return pass;
return subtest blah => sub { pass };
}
diag "Perl $^V";
diag "VERSION $Test::More::VERSION";
for my $i ( 1..2 ) {
check_test(
sub { bongo() },
{ ok => 1 },
"Test I=$i"
);
}
$ prove -v foo.t
[15:45:19] foo.t .. [2/3033]
1..15
# Perl v5.20.3
# VERSION 1.302015
# Subtest: blah
not ok 1 - Test 'Test I=1' completed
# Failed test 'Test 'Test I=1' completed'
# at foo.t line 26.
# Can't call method "top" on an undefined value at /var/perl5.20.3/lib/site_perl/5.20.3/Test/Builder.pm line 56.
ok 2 - Test 'Test I=1' no premature diagnostication
not ok 3 - Test 'Test I=1' result count
# Failed test 'Test 'Test I=1' result count'
# at foo.t line 26.
# got: 0
# expected: 1
not ok 4 - subtest '' of 'Test I=1' compare ok
# Failed test 'subtest '' of 'Test I=1' compare ok'
# at foo.t line 26.
# got: undef
# expected: '1'
not ok 5 - checking depth
# Failed test 'checking depth'
# at foo.t line 26.
# got: undef
# expected: '1'
# You need to change $Test::Builder::Level
# Subtest: blah
not ok 1 - Test 'Test I=2' completed
# Failed test 'Test 'Test I=2' completed'
# at foo.t line 26.
# Can't call method "top" on an undefined value at /var/perl5.20.3/lib/site_perl/5.20.3/Test/Builder.pm line 56.
ok 2 - Test 'Test I=2' no premature diagnostication
not ok 3 - Test 'Test I=2' result count
# Failed test 'Test 'Test I=2' result count'
# at foo.t line 26.
# got: 0
# expected: 1
not ok 4 - subtest '' of 'Test I=2' compare ok
# Failed test 'subtest '' of 'Test I=2' compare ok'
# at foo.t line 26.
# got: undef
# expected: '1'
not ok 5 - checking depth
# Failed test 'checking depth'
# at foo.t line 26.
# got: undef
# expected: '1'
# You need to change $Test::Builder::Level
# Test ended with extra hubs on the stack!
# No tests run!
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 15/15 subtests
[15:45:20]
Test Summary Report
-------------------
foo.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 15 tests but ran 0.
Files=1, Tests=0, 1 wallclock secs ( 0.02 usr 0.01 sys + 0.05 cusr 0.00 csys = 0.08 CPU)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment