diff options
| author | Abigail <abigail@abigail.be> | 2020-11-11 17:06:09 +0100 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2020-11-11 17:06:09 +0100 |
| commit | 0cd283078fcdfea7a3c32ac1bae9cdb989fb62d0 (patch) | |
| tree | 6262758ce6067bd7f30d696a9b7d23be5087394a /challenge-086 | |
| parent | 5363e88f3d502d0a3e647b151f8a6259156f2665 (diff) | |
| download | perlweeklychallenge-club-0cd283078fcdfea7a3c32ac1bae9cdb989fb62d0.tar.gz perlweeklychallenge-club-0cd283078fcdfea7a3c32ac1bae9cdb989fb62d0.tar.bz2 perlweeklychallenge-club-0cd283078fcdfea7a3c32ac1bae9cdb989fb62d0.zip | |
Skip tests which take a long time, unless the --slow option is used.
Diffstat (limited to 'challenge-086')
| -rwxr-xr-x | challenge-086/abigail/test.pl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/challenge-086/abigail/test.pl b/challenge-086/abigail/test.pl index c477976fa7..924c50714d 100755 --- a/challenge-086/abigail/test.pl +++ b/challenge-086/abigail/test.pl @@ -18,6 +18,11 @@ use experimental 'signatures'; use Test::More; use DBI; +use Getopt::Long; + +GetOptions 'slow' => \my $run_slow_tests, +; + my %languages = ( Perl => { @@ -89,14 +94,29 @@ foreach my $challenge (1, 2) { subtest $language => sub { foreach my $input (@inputs) { + SKIP: { my $output_exp = ($input =~ s/input/output/r) . ".exp"; my $exp = `cat $output_exp`; my $name = $input; + my %pragma; + + while ($exp =~ s/^\s*#%\s*(.*)\n//) { + my $pragma = $1; + $pragma =~ s/\s+$//; + if (lc $pragma eq "slow") { + $pragma {slow} = 1; + next; + } + } + if ($exp =~ s/^\s*#\s*(.*)\n//) { $name = $1; } + skip "Skipping slow test", 1 + if $pragma {slow} && !$run_slow_tests; + my $got; if ($compiled) { $got = `$perl_exe -ple '$filter' $input | ./$compiled`; @@ -111,7 +131,7 @@ foreach my $challenge (1, 2) { s/\h+$//gm for $exp, $got; is $got, $exp, $name; - } + }} }; unlink $compiled if $compiled; |
