Improved tar support
Change-Id: I318b6f18e571c81a34752911bc9d009d726c7d14
diff --git a/t/script/archive_tar.t b/t/script/archive_tar.t
new file mode 100644
index 0000000..aee6542
--- /dev/null
+++ b/t/script/archive_tar.t
@@ -0,0 +1,68 @@
+#/usr/bin/env perl
+use strict;
+use warnings;
+use File::Basename 'dirname';
+use File::Spec::Functions qw/catdir catfile/;
+use File::Temp qw/tempdir/;
+use Mojo::File;
+use Mojo::Util qw/quote/;
+use Mojo::JSON qw/decode_json/;
+use IO::Uncompress::Gunzip;
+use Test::More;
+use Test::Output qw/:stdout :stderr :functions/;
+use Data::Dumper;
+use KorAP::XML::Archive;
+use utf8;
+
+my $f = dirname(__FILE__);
+my $script = catfile($f, '..', '..', 'script', 'korapxml2krill');
+
+my $call = join(
+ ' ',
+ 'perl', $script,
+ 'archive'
+);
+
+unless (KorAP::XML::Archive::test_unzip) {
+ plan skip_all => 'unzip not found';
+};
+
+# Test without parameters
+stdout_like(
+ sub {
+ system($call);
+ },
+ qr!archive.+?\$ korapxml2krill!s,
+ $call
+);
+
+my $input = catfile($f, '..', 'corpus', 'archive.zip');
+ok(-f $input, 'Input archive found');
+
+my $output = File::Temp->new;
+
+ok(-f $output, 'Output directory exists');
+
+my $input_quotes = "'".catfile($f, '..', 'corpus', 'archives', 'wpd15*.zip') . "'";
+
+$call = join(
+ ' ',
+ 'perl', $script,
+ 'archive',
+ '--input' => $input_quotes,
+ '--output' => $output . '.tar',
+ '-t' => 'Base#tokens_aggr',
+ '--to-tar'
+);
+
+# Test without parameters
+my $combined = combined_from( sub { system($call) });
+
+diag $combined;
+
+#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,
+
+
+
+done_testing;
+__END__