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.
|
Follow me: