Akron | 414ec95 | 2020-08-03 15:48:43 +0200 | [diff] [blame^] | 1 | #/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use File::Basename 'dirname'; |
| 5 | use File::Spec::Functions qw/catdir catfile/; |
| 6 | use File::Temp qw/:POSIX/; |
| 7 | use Mojo::File; |
| 8 | use Mojo::Util qw/quote/; |
| 9 | use Mojo::JSON qw/decode_json/; |
| 10 | use IO::Uncompress::Gunzip; |
| 11 | use Test::More; |
| 12 | use Test::Output qw/:stdout :stderr :combined :functions/; |
| 13 | use Data::Dumper; |
| 14 | use KorAP::XML::Archive; |
| 15 | use utf8; |
| 16 | |
| 17 | if ($ENV{SKIP_SCRIPT} || $ENV{SKIP_REAL}) { |
| 18 | plan skip_all => 'Skip script/real tests'; |
| 19 | }; |
| 20 | |
| 21 | my $f = dirname(__FILE__); |
| 22 | my $script = catfile($f, '..', '..', '..', 'script', 'korapxml2krill'); |
| 23 | |
| 24 | my $cache = tmpnam(); |
| 25 | |
| 26 | my $output = File::Temp->newdir(CLEANUP => 0); |
| 27 | $output->unlink_on_destroy(0); |
| 28 | |
| 29 | my $input = catfile($f, '..', 'corpus', 'WDD15', 'A79', '83946'); |
| 30 | my $call = join( |
| 31 | ' ', |
| 32 | 'perl', $script, |
| 33 | '--input' => $input, |
| 34 | '--cache' => $cache |
| 35 | ); |
| 36 | |
| 37 | # Test without compression |
| 38 | { |
| 39 | local $SIG{__WARN__} = sub {}; |
| 40 | my $out = combined_from(sub { system($call); }); |
| 41 | |
| 42 | like($out, qr!No tokens found!s, $call); |
| 43 | }; |
| 44 | |
| 45 | |
| 46 | done_testing; |
| 47 | __END__ |