blob: ab71634c08e2350a323bc0a19e43d57e38ad2d24 [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
9my $f = dirname(__FILE__);
10my $script = catfile($f, '..', '..', 'script', 'korapxml2krill');
11
Akronbd3adda2017-04-11 15:00:55 +020012my $input_base = catdir($f, '..', 'corpus');
Akron63f20d42017-04-10 23:40:29 +020013
14# Temporary output
15my $output = File::Temp->newdir(CLEANUP => 0);
16
Akron5fd2d8e2017-06-19 15:29:39 +020017my $cache = tmpnam();
18
Akron63f20d42017-04-10 23:40:29 +020019my $call = join(
20 ' ',
21 'perl', $script,
22 'serial',
Akronbd3adda2017-04-11 15:00:55 +020023 '-t' => 'Base#tokens_aggr',
24 '-i' => '"archive.zip"',
25 '-i' => '"archives/wpd15*.zip"',
Akron5fd2d8e2017-06-19 15:29:39 +020026 '--cache' => $cache,
Akron63f20d42017-04-10 23:40:29 +020027 '-ib' => $input_base,
Akronbd3adda2017-04-11 15:00:55 +020028 '-o' => $output
Akron63f20d42017-04-10 23:40:29 +020029);
30
31# Test without parameters
Akronbd3adda2017-04-11 15:00:55 +020032my $stdout = stdout_from(sub { system($call) });
Akron63f20d42017-04-10 23:40:29 +020033
Akronbd3adda2017-04-11 15:00:55 +020034like($stdout, qr!Start serial processing of .+?wpd15\*\.zip!, 'Processing');
35like($stdout, qr!Start serial processing .+?archive.zip!, 'Processing');
36
37like($stdout, qr!Processed .+?/archive/TEST-BSP-1\.json!, 'Archive file');
38like($stdout, qr!Processed .+?/archives-wpd15/WPD15-A00-00081\.json!, 'Archive file');
Akron63f20d42017-04-10 23:40:29 +020039
40done_testing;
41__END__