Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 4 | use Test::Output qw/stdout_from/; |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 5 | use File::Basename 'dirname'; |
| 6 | use File::Spec::Functions qw/catdir catfile/; |
| 7 | use File::Temp qw/tempdir/; |
| 8 | |
| 9 | my $f = dirname(__FILE__); |
| 10 | my $script = catfile($f, '..', '..', 'script', 'korapxml2krill'); |
| 11 | |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 12 | my $input_base = catdir($f, '..', 'corpus'); |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 13 | |
| 14 | # Temporary output |
| 15 | my $output = File::Temp->newdir(CLEANUP => 0); |
| 16 | |
| 17 | my $call = join( |
| 18 | ' ', |
| 19 | 'perl', $script, |
| 20 | 'serial', |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 21 | '-t' => 'Base#tokens_aggr', |
| 22 | '-i' => '"archive.zip"', |
| 23 | '-i' => '"archives/wpd15*.zip"', |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 24 | '-ib' => $input_base, |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 25 | '-o' => $output |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 26 | ); |
| 27 | |
| 28 | # Test without parameters |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 29 | my $stdout = stdout_from(sub { system($call) }); |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 30 | |
Akron | bd3adda | 2017-04-11 15:00:55 +0200 | [diff] [blame] | 31 | like($stdout, qr!Start serial processing of .+?wpd15\*\.zip!, 'Processing'); |
| 32 | like($stdout, qr!Start serial processing .+?archive.zip!, 'Processing'); |
| 33 | |
| 34 | like($stdout, qr!Processed .+?/archive/TEST-BSP-1\.json!, 'Archive file'); |
| 35 | like($stdout, qr!Processed .+?/archives-wpd15/WPD15-A00-00081\.json!, 'Archive file'); |
Akron | 63f20d4 | 2017-04-10 23:40:29 +0200 | [diff] [blame] | 36 | |
| 37 | done_testing; |
| 38 | __END__ |