From 0cd283078fcdfea7a3c32ac1bae9cdb989fb62d0 Mon Sep 17 00:00:00 2001 From: Abigail Date: Wed, 11 Nov 2020 17:06:09 +0100 Subject: Skip tests which take a long time, unless the --slow option is used. --- challenge-086/abigail/test.pl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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; -- cgit