Skip to content

Instantly share code, notes, and snippets.

@petdance
Created May 15, 2017 21:48
Show Gist options
  • Save petdance/8a7519103e42c405a1ceadf553b2eccb to your computer and use it in GitHub Desktop.
Save petdance/8a7519103e42c405a1ceadf553b2eccb to your computer and use it in GitHub Desktop.
Failure in Test::Tester
use strict;
use warnings;
use Test::Tester;
use Test::More tests => 1;
use TW::Test::More;
check_test( sub { is_fs_custnum( 'GARBAGECRAP' ) }, { ok => 0 }, 'Garbage should fail' );
prove -r -I/home/alester/tw/Lib --source=Perl --ext=.t --source=PHP --php-option=include_path=/home/alester/tw/Class:/home/alester/tw/Include --php-option=extension=.phpt --ext=.phpt -v foo.t
[16:47:30] foo.t ..
1..1
# Subtest: is_fs_custnum()
not ok 1 - Test 'Garbage should fail' completed
# Failed test 'Test 'Garbage should fail' completed'
# at foo.t line 12.
# Can't call method "top" on an undefined value at /var/perl5.20.3/lib/site_perl/5.20.3/Test/Builder.pm line 45.
ok 2 - Test 'Garbage should fail' no premature diagnostication
not ok 3 - Test 'Garbage should fail' result count
# Failed test 'Test 'Garbage should fail' result count'
# at foo.t line 12.
# got: 0
# expected: 1
not ok 4 - subtest '' of 'Garbage should fail' compare ok
# Failed test 'subtest '' of 'Garbage should fail' compare ok'
# at foo.t line 12.
# got: undef
# expected: '0'
not ok 5 - checking depth
# Failed test 'checking depth'
# at foo.t line 12.
# 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 1/1 subtests
[16:47:31]
Test Summary Report
-------------------
foo.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 1 tests but ran 0.
Files=1, Tests=0, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.13 cusr 0.01 csys = 0.16 CPU)
Result: FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment