diff options
| author | Abigail <abigail@abigail.be> | 2020-09-15 14:30:29 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2020-09-15 14:30:29 +0200 |
| commit | ffbd8368ce571dab7b941dd8aa8e50f2f5678b5b (patch) | |
| tree | 64a331f9ce6ebc0d099901e89c804fc4488c0621 | |
| parent | df4aee15abcc46f8b2844b7ba035b45afa0ff31e (diff) | |
| download | perlweeklychallenge-club-ffbd8368ce571dab7b941dd8aa8e50f2f5678b5b.tar.gz perlweeklychallenge-club-ffbd8368ce571dab7b941dd8aa8e50f2f5678b5b.tar.bz2 perlweeklychallenge-club-ffbd8368ce571dab7b941dd8aa8e50f2f5678b5b.zip | |
Modify the test program so it tests Javascript solutions as well.
| -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; |
