blob: aee6542da5ab09230152b03fea122775985dca38 [file] [log] [blame]
Akron486f9ab2017-04-22 23:25:19 +02001#/usr/bin/env perl
2use strict;
3use warnings;
4use File::Basename 'dirname';
5use File::Spec::Functions qw/catdir catfile/;
6use File::Temp qw/tempdir/;
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 :functions/;
13use Data::Dumper;
14use KorAP::XML::Archive;
15use utf8;
16
17my $f = dirname(__FILE__);
18my $script = catfile($f, '..', '..', 'script', 'korapxml2krill');
19
20my $call = join(
21 ' ',
22 'perl', $script,
23 'archive'
24);
25
26unless (KorAP::XML::Archive::test_unzip) {
27 plan skip_all => 'unzip not found';
28};
29
30# Test without parameters
31stdout_like(
32 sub {
33 system($call);
34 },
35 qr!archive.+?\$ korapxml2krill!s,
36 $call
37);
38
39my $input = catfile($f, '..', 'corpus', 'archive.zip');
40ok(-f $input, 'Input archive found');
41
42my $output = File::Temp->new;
43
44ok(-f $output, 'Output directory exists');
45
46my $input_quotes = "'".catfile($f, '..', 'corpus', 'archives', 'wpd15*.zip') . "'";
47
48$call = join(
49 ' ',
50 'perl', $script,
51 'archive',
52 '--input' => $input_quotes,
53 '--output' => $output . '.tar',
54 '-t' => 'Base#tokens_aggr',
55 '--to-tar'
56);
57
58# Test without parameters
59my $combined = combined_from( sub { system($call) });
60
61diag $combined;
62
63#qr!Input is .+?wpd15-single\.zip,.+?wpd15-single\.malt\.zip,.+?wpd15-single\.corenlp\.zip,.+?wpd15-single\.opennlp\.zip,.+?wpd15-single\.mdparser\.zip,.+?wpd15-single\.tree_tagger\.zip!is,
64
65
66
67done_testing;
68__END__