Marc Kupietz | bb739b0 | 2020-09-22 16:49:34 +0200 | [diff] [blame^] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use Test::Script; |
| 5 | |
| 6 | script_runs([ 'script/korapxml2conllu', '-h' ], { exit => 255 }); |
| 7 | script_stderr_like "Description", "Can print help message"; |
| 8 | |
| 9 | for my $morpho_fname (glob("t/data/*\.*\.zip")) { |
| 10 | my $base_fname = $morpho_fname =~ s/(.*)\..*\.zip/$1.zip/r; |
| 11 | die "cannot find $base_fname" if (!-e $base_fname); |
| 12 | |
| 13 | my $conllu_fname = $base_fname =~ s/(.*)\.zip/$1.conllu/r; |
| 14 | die "cannot find $conllu_fname" if (!-e $conllu_fname); |
| 15 | |
| 16 | my $expected; |
| 17 | open(my $fh, '<', $conllu_fname) or die "cannot open file $conllu_fname"; { |
| 18 | local $/; |
| 19 | $expected = <$fh>; |
| 20 | } |
| 21 | close($fh); |
| 22 | script_runs([ 'script/korapxml2conllu', $morpho_fname ], "Runs with input"); |
| 23 | script_stdout_is $expected, "Converts $morpho_fname correctly"; |
| 24 | } |
| 25 | done_testing; |