You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

5.12. Forget about your "plan", use "no_plan"

Example 5-17. examples/intro/t12_calc.t

#!/usr/bin/perl
use strict;
use warnings;

my %tests = (
    '1 + 1'     => 2,
    '2 + 2'     => 4,
    '2 + 2 + 2' => 6,
    '1+1'       => 2,
    '0+ -1'     => -1,
    '0-1'       => -1,
    '-1+1'      => 0,
);

use Test::Simple "no_plan";

foreach my $t ( keys %tests ) {
    ok( `./mycalc $t` == $tests{$t}, $t );
}

Example 5-18. examples/intro/t12_calc.out

ok 1 - 0-1
ok 2 - 1 + 1
ok 3 - -1+1
ok 4 - 0+ -1
ok 5 - 1+1
not ok 6 - 2 + 2 + 2
#   Failed test '2 + 2 + 2'
#   in t12_calc.t at line 18.
ok 7 - 2 + 2
1..7
# Looks like you failed 1 test of 7.

The 1..7 is now at the end.


If you are interested in on-site trainings by the author, please contact me directly.