blob: a4a64f12447bacc65b0265471fb1c4b1fb91b58d [file] [log] [blame]
Akron63f20d42017-04-10 23:40:29 +02001use strict;
2use warnings;
3use Test::More;
Akronbd3adda2017-04-11 15:00:55 +02004use Test::Output qw/stdout_from/;
Akron63f20d42017-04-10 23:40:29 +02005use File::Basename 'dirname';
6use File::Spec::Functions qw/catdir catfile/;
Akron5fd2d8e2017-06-19 15:29:39 +02007use File::Temp qw/:POSIX/;
Akron63f20d42017-04-10 23:40:29 +02008
Akronfab17d32020-07-31 14:38:29 +02009if ($ENV{SKIP_SCRIPT}) {
10 plan skip_all => 'Skip script tests';
11};
12
Akron63f20d42017-04-10 23:40:29 +020013my $f = dirname(__FILE__);
14my $script = catfile($f, '..', '..', 'script', 'korapxml2krill');
15
Akronbd3adda2017-04-11 15:00:55 +020016my $input_base = catdir($f, '..', 'corpus');
Akron63f20d42017-04-10 23:40:29 +020017
18# Temporary output
19my $output = File::Temp->newdir(CLEANUP => 0);
20
Akron5fd2d8e2017-06-19 15:29:39 +020021my $cache = tmpnam();
22
Akron63f20d42017-04-10 23:40:29 +020023my $call = join(
24 ' ',
25 'perl', $script,
26 'serial',
Akronbd3adda2017-04-11 15:00:55 +020027 '-t' => 'Base#tokens_aggr',
28 '-i' => '"archive.zip"',
29 '-i' => '"archives/wpd15*.zip"',
Akron5fd2d8e2017-06-19 15:29:39 +020030 '--cache' => $cache,
Akron63f20d42017-04-10 23:40:29 +020031 '-ib' => $input_base,
Akronbd3adda2017-04-11 15:00:55 +020032 '-o' => $output
Akron63f20d42017-04-10 23:40:29 +020033);
34
35# Test without parameters
Akronbd3adda2017-04-11 15:00:55 +020036my $stdout = stdout_from(sub { system($call) });
Akron63f20d42017-04-10 23:40:29 +020037
Akronbd3adda2017-04-11 15:00:55 +020038like($stdout, qr!Start serial processing of .+?wpd15\*\.zip!, 'Processing');
39like($stdout, qr!Start serial processing .+?archive.zip!, 'Processing');
40
41like($stdout, qr!Processed .+?/archive/TEST-BSP-1\.json!, 'Archive file');
42like($stdout, qr!Processed .+?/archives-wpd15/WPD15-A00-00081\.json!, 'Archive file');
Akron63f20d42017-04-10 23:40:29 +020043
44done_testing;
45__END__