5.13. Put the test cases in an external fileExample 5-19. examples/intro/t13_calc.t #!/usr/bin/perl
use strict;
use warnings;
use Test::Simple "no_plan";
open my $fh, "<", "calc.txt" or die $!;
while ( my $line = <$fh> ) {
chomp $line;
next if $line =~ /^\s*$/;
next if $line =~ /^#/;
my ( $exp, $res ) = split /\s*=\s*/, $line;
ok( `./mycalc $exp` == $res, $exp );
}
|
Follow me: