blob: 721f1bc771b76796c6ce2299cae1453442d20d6d [file] [log] [blame]
Akron414ec952020-08-03 15:48:43 +02001#/usr/bin/env perl
2use strict;
3use warnings;
4use File::Basename 'dirname';
5use File::Spec::Functions qw/catdir catfile/;
6use File::Temp qw/:POSIX/;
7use Mojo::File;
8use Mojo::Util qw/quote/;
9use Mojo::JSON qw/decode_json/;
10use IO::Uncompress::Gunzip;
11use Test::More;
12use Test::Output qw/:stdout :stderr :combined :functions/;
13use Data::Dumper;
14use KorAP::XML::Archive;
15use utf8;
16
17if ($ENV{SKIP_SCRIPT} || $ENV{SKIP_REAL}) {
18 plan skip_all => 'Skip script/real tests';
19};
20
21my $f = dirname(__FILE__);
22my $script = catfile($f, '..', '..', '..', 'script', 'korapxml2krill');
23
24my $cache = tmpnam();
25
26my $output = File::Temp->newdir(CLEANUP => 0);
27$output->unlink_on_destroy(0);
28
29my $input = catfile($f, '..', 'corpus', 'WDD15', 'A79', '83946');
30my $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
46done_testing;
47__END__