Example 6-11. examples/intro/early-abnormal-exit.t
#!/usr/bin/perl use strict; use warnings; # example of tests where the script dies before running all the tests use Test::More tests => 4; is `./mycalc 1 + 1`, 2, '1+1'; is `./mycalc 2 + 2`, 4, '2+2'; exit; is `./mycalc 3 + 3`, 6, '3+3'; is `./mycalc 4 + 4`, 8, '4+4';
Directly:
1..4 ok 1 - 1+1 ok 2 - 2+2 # Looks like you planned 4 tests but only ran 2.
With Harness:
early-abnormal-exit....ok 2/4# Looks like you planned 4 tests but only ran 2.
early-abnormal-exit....dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 3-4
Failed 2/4 tests, 50.00% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
----------------------------
early-abnormal-exit.t 2 512 4 4 100.00% 3-4
Failed 1/1 test scripts, 0.00% okay. 2/4 subtests failed, 50.00% okay.| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Number of tests | Up | Less than planned tests - Early Normal Exit |