Provide conllu2korapxml to convert from ConLL-U to KorAP-XML zip
Change-Id: I8913abac4713800bf38b38935004fd6ee416aab1
diff --git a/t/test.t b/t/test.t
index 1077bc0..73c3515 100644
--- a/t/test.t
+++ b/t/test.t
@@ -2,6 +2,8 @@
use warnings;
use Test::More;
use Test::Script;
+use Test::TempDir::Tiny;
+use File::Copy;
script_runs([ 'script/korapxml2conllu', '-h' ], { exit => 255 });
script_stderr_like "Description", "Can print help message";
@@ -37,4 +39,25 @@
script_stdout_is $expected, "Converts $base_fname correctly to CoNLL-U";
}
-done_testing;
\ No newline at end of file
+my $test_tempdir = tempdir();
+my $expected;
+open(my $fh, '<', "t/data/goe.morpho.conllu"); {
+ local $/;
+ $expected = <$fh>;
+}
+close($fh);
+
+my $zipfile = "$test_tempdir/goe.tree_tagger.zip";
+my $zipcontent;
+script_runs([ 'script/conllu2korapxml', "t/data/goe.morpho.conllu" ], {stdout => \$zipcontent},
+ "Converts t/data/goe.morpho.conllu to KorAP-XML zip");
+open(my $fh, ">", $zipfile) or fail("cannot open file $zipfile for writing");
+print $fh $zipcontent;
+close($fh);
+
+copy("t/data/goe.zip", $test_tempdir);
+script_runs([ 'script/korapxml2conllu', "$test_tempdir/goe.tree_tagger.zip" ],
+ "Converts $test_tempdir/goe.tree_tagger.zip to CoNLL-U");
+script_stdout_is $expected, "Full round trip: Converts goe.morpho.conllu to KorAP-XML and back to CoNLL-U correctly";
+
+done_testing;