diff options
| -rwxr-xr-x | challenge-078/abigail/test.pl | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/challenge-078/abigail/test.pl b/challenge-078/abigail/test.pl index 2a0406cf31..115e570c62 100755 --- a/challenge-078/abigail/test.pl +++ b/challenge-078/abigail/test.pl @@ -17,12 +17,25 @@ use experimental 'signatures'; use Test::More; +my %languages = ( + Perl => ["/opt/perl/bin/perl" => 'pl'], + JavaScript => ["/usr/local/bin/node" => 'js'], +); + + my @inputs = <input*>; -foreach my $input (@inputs) { - my $output_exp = ($input =~ s/input/output/r) . ".exp"; - my $exp = `cat $output_exp`; - my $got = `./solution.pl < $input`; - is $got, $exp, $input; + +foreach my $language (sort keys %languages) { + my ($exe, $ext) = @{$languages {$language}}; + next unless -r "solution.$ext"; + subtest $language => sub { + foreach my $input (@inputs) { + my $output_exp = ($input =~ s/input/output/r) . ".exp"; + my $exp = `cat $output_exp`; + my $got = `$exe ./solution.$ext < $input`; + is $got, $exp, $input; + } + } } done_testing; |
