Support templates in test_tei2korapxml
Change-Id: Ibe8981d8b5919661ef10a5b68b9c53bfb4da1af3
diff --git a/t/test.t b/t/test.t
index de0c65e..a549e1e 100644
--- a/t/test.t
+++ b/t/test.t
@@ -8,7 +8,8 @@
unshift @INC, "$FindBin::Bin/../lib";
};
-use_ok('Test::KorAP::XML::TEI','korap_tempfile', 'i5_template');
+use_ok('Test::KorAP::XML::TEI','korap_tempfile', 'i5_template', 'test_tei2korapxml');
+
subtest 'korap_tempfile' => sub {
my ($fh, $filename) = korap_tempfile('test');
@@ -26,6 +27,7 @@
like($filename, qr!KorAP-XML-TEI_.+?\.tmp$!, 'Filename pattern');
};
+
subtest 'i5_template' => sub {
my $tpl = i5_template();
my $t = Test::XML::Loy->new($tpl);
@@ -50,4 +52,24 @@
;
};
+
+subtest 'test_tei2korapxml_i5_template' => sub {
+ test_tei2korapxml(
+ template => {
+ text => 'Das ist ein gutes Beispiel',
+ korpusSigle => 'a',
+ dokumentSigle => 'a/b',
+ textSigle => 'a/b.1'
+ },
+ param => '-ti'
+ )
+ ->stderr_like(qr!tei2korapxml: .*? text_id=a_b\.1!)
+ ->file_exists('a/b/1/header.xml')
+ ->file_exists('a/b/header.xml')
+ ->file_exists('a/header.xml')
+ ->unzip_xml('a/b/1/data.xml')
+ ->attr_is('raw_text', 'docid', 'a_b.1')
+ ->text_is('text', 'Das ist ein gutes Beispiel');
+};
+
done_testing;