blob: 6fb883f836249f9fad2bf13f2a1f80b59b802d89 [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/;
7use File::Temp qw/tempdir/;
8
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
17my $call = join(
18 ' ',
19 'perl', $script,
20 'serial',
Akronbd3adda2017-04-11 15:00:55 +020021 '-t' => 'Base#tokens_aggr',
22 '-i' => '"archive.zip"',
23 '-i' => '"archives/wpd15*.zip"',
Akron63f20d42017-04-10 23:40:29 +020024 '-ib' => $input_base,
Akronbd3adda2017-04-11 15:00:55 +020025 '-o' => $output
Akron63f20d42017-04-10 23:40:29 +020026);
27
28# Test without parameters
Akronbd3adda2017-04-11 15:00:55 +020029my $stdout = stdout_from(sub { system($call) });
Akron63f20d42017-04-10 23:40:29 +020030
Akronbd3adda2017-04-11 15:00:55 +020031like($stdout, qr!Start serial processing of .+?wpd15\*\.zip!, 'Processing');
32like($stdout, qr!Start serial processing .+?archive.zip!, 'Processing');
33
34like($stdout, qr!Processed .+?/archive/TEST-BSP-1\.json!, 'Archive file');
35like($stdout, qr!Processed .+?/archives-wpd15/WPD15-A00-00081\.json!, 'Archive file');
Akron63f20d42017-04-10 23:40:29 +020036
37done_testing;
38__END__