blob: 9521d738e33f2df015545b19223f05c753bc2fff [file] [log] [blame]
Akron797e8072020-02-13 07:59:40 +01001use strict;
2use warnings;
3use File::Basename 'dirname';
4use File::Spec::Functions qw/catfile/;
Peter Harders1c5ce152020-07-22 18:02:50 +02005use Encode qw!encode_utf8 decode_utf8 encode!;
Akron797e8072020-02-13 07:59:40 +01006
7use Test::More;
8use Test::Output;
Peter Harders42e18a62020-07-21 02:43:26 +02009
10use FindBin;
11BEGIN {
12 unshift @INC, "$FindBin::Bin/../lib";
13};
Peter Harders1c5ce152020-07-22 18:02:50 +020014
Akron044bd922020-07-30 09:12:28 +020015use Test::KorAP::XML::TEI qw!korap_tempfile i5_template test_tei2korapxml!;
Peter Harders57c884e2020-07-16 01:28:52 +020016
Akron797e8072020-02-13 07:59:40 +010017my $f = dirname(__FILE__);
18my $script = catfile($f, '..', 'script', 'tei2korapxml');
19ok(-f $script, 'Script found');
20
Akrond949e182020-02-14 12:23:57 +010021stdout_like(
Akron797e8072020-02-13 07:59:40 +010022 sub { system('perl', $script, '--help') },
Akrond949e182020-02-14 12:23:57 +010023 qr!This\s*program\s*is\s*usually\s*called\s*from\s*inside\s*another\s*script\.!,
Akron797e8072020-02-13 07:59:40 +010024 'Help'
25);
26
Akron044bd922020-07-30 09:12:28 +020027
Akrond949e182020-02-14 12:23:57 +010028stdout_like(
29 sub { system('perl', $script, '--version') },
30 qr!tei2korapxml - v\d+?\.\d+?!,
31 'Version'
32);
33
Akron2a60c532020-02-13 15:52:18 +010034# Load example file
35my $file = catfile($f, 'data', 'goe_sample.i5.xml');
Peter Harders57c884e2020-07-16 01:28:52 +020036
Akron044bd922020-07-30 09:12:28 +020037subtest 'Basic processing' => sub {
Akron2a60c532020-02-13 15:52:18 +010038
Akron044bd922020-07-30 09:12:28 +020039 my $t = test_tei2korapxml(
40 tmp => 'script_out',
41 file => $file,
42 param => '-ti'
43 )->stderr_like(qr!tei2korapxml: .*? text_id=GOE_AGA\.00000!);
Akron2a60c532020-02-13 15:52:18 +010044
Akron68966082020-02-13 15:52:18 +010045
Akron044bd922020-07-30 09:12:28 +020046 # Uncompress GOE/header.xml from zip file
47 $t->unzip_xml('GOE/header.xml')
Akron2a60c532020-02-13 15:52:18 +010048
Akron044bd922020-07-30 09:12:28 +020049 # TODO: check wrong encoding in header-files (compare with input document)!
50 ->text_is('korpusSigle', 'GOE', 'korpusSigle')
51 ->text_is('h\.title[type=main]', 'Goethes Werke', 'h.title')
52 ->text_is('h\.author', 'Goethe, Johann Wolfgang von', 'h.author')
53 ->text_is('pubDate[type=year]', '1982', 'pubDate');
Akron2a60c532020-02-13 15:52:18 +010054
Akron044bd922020-07-30 09:12:28 +020055 # Uncompress GOE/AGA/header.xml from zip file
56 $t->unzip_xml('GOE/AGA/header.xml')
57 ->text_is('dokumentSigle', 'GOE/AGA', 'dokumentSigle')
58 ->text_is('d\.title', 'Goethe: Autobiographische Schriften II, (1817-1825, 1832)', 'd.title')
59 ->text_is('creatDate', '1820-1822', 'creatDate');
Akron2a60c532020-02-13 15:52:18 +010060
Akron044bd922020-07-30 09:12:28 +020061 # Uncompress GOE/AGA/00000/header.xml from zip file
62 $t->unzip_xml('GOE/AGA/00000/header.xml')
63 ->text_is('textSigle', 'GOE/AGA.00000', 'textSigle')
64 ->text_is('analytic > h\.title[type=main]', 'Campagne in Frankreich', 'h.title');
Akron2a60c532020-02-13 15:52:18 +010065
66# Uncompress GOE/AGA/00000/data.xml from zip file
Akron044bd922020-07-30 09:12:28 +020067 $t->unzip_xml('GOE/AGA/00000/data.xml')
68 ->attr_is('raw_text', 'docid', 'GOE_AGA.00000', 'text id')
Marc Kupietzfd0e6a92020-09-09 18:07:29 +020069 ->text_like('raw_text > text', qr!^Campagne in Frankreich 1792.*?uns allein begl.*cke\.$!, 'text content')
70 ->text_like('raw_text > text', qr!unter dem Titel "Kriegstheater"!, 'text content');
Akron2a60c532020-02-13 15:52:18 +010071
Akron044bd922020-07-30 09:12:28 +020072 $t->unzip_xml('GOE/AGA/00000/struct/structure.xml')
Akronc57625b2020-07-30 11:46:06 +020073 ->text_is('span[id=s3] *[name=type]', 'Autobiographie', 'text content')
74 ->text_is('#s3 *[name=type]', 'Autobiographie', 'text content')
75 ->attr_is('#s0','to','1266')
76 ->attr_is('#s0','l','1')
77
78 ->attr_is('#s18','from','925')
79 ->attr_is('#s18','to','1266')
80 ->attr_is('#s18','l','5')
81 ->attr_is('#s18 > fs','type', 'struct')
82 ->attr_is('#s18 > fs > f','name','name')
83 ->text_is('#s18 > fs > f','poem')
84
85 ->attr_is('#s19','from','925')
86 ->attr_is('#s19','to','1098')
87 ->attr_is('#s19','l','6')
88 ->attr_is('#s19 > fs','type','struct')
89 ->text_is('#s19 > fs > f[name=name]','lg')
90 ->text_is('#s19 > fs > f[name=attr] > fs[type=attr] >f[name=part]','u')
91
92 ->attr_is('#s37','from','1229')
93 ->attr_is('#s37','to','1266')
94 ->attr_is('#s37','l','8')
95 ->attr_is('#s37 > fs','type','struct')
96 ->text_is('#s37 > fs > f[name=name]','s')
97 ->text_is('#s37 > fs > f[name=attr] > fs[type=attr] > f[name=type]','manual')
98
99 ->attr_is('#s38','from','1266')
100 ->attr_is('#s38','to','1266')
101 ->attr_is('#s38','l','2')
102 ->attr_is('#s38 > fs','type','struct')
103 ->text_is('#s38 > fs > f[name=name]','back')
104 ->element_count_is('', 196);
Akron2a60c532020-02-13 15:52:18 +0100105
Akron044bd922020-07-30 09:12:28 +0200106 $t->file_exists_not('GOE/AGA/00000/base/tokens.xml', 'External not generated');
Akron2a60c532020-02-13 15:52:18 +0100107
Akron044bd922020-07-30 09:12:28 +0200108 # Uncompress GOE/AGA/00000/base/tokens_aggressive.xml from zip file
109 $t->unzip_xml('GOE/AGA/00000/base/tokens_aggressive.xml')
110 ->attr_is('spanList span:nth-child(1)', 'to', 8)
111 ->attr_is('spanList span#t_1', 'from', 9)
112 ->attr_is('spanList span#t_1', 'to', 11)
Akron2a60c532020-02-13 15:52:18 +0100113
Akron044bd922020-07-30 09:12:28 +0200114 ->attr_is('spanList span#t_67', 'from', 427)
115 ->attr_is('spanList span#t_67', 'to', 430)
Akron2a60c532020-02-13 15:52:18 +0100116
Akron044bd922020-07-30 09:12:28 +0200117 ->attr_is('spanList span#t_214', 'from', 1209)
118 ->attr_is('spanList span#t_214', 'to', 1212)
Akron2a60c532020-02-13 15:52:18 +0100119
Akron044bd922020-07-30 09:12:28 +0200120 ->element_count_is('spanList span', 227);
Peter Harders57c884e2020-07-16 01:28:52 +0200121
Akron044bd922020-07-30 09:12:28 +0200122 # Uncompress GOE/AGA/00000/base/tokens_conservative.xml from zip file
123 $t->unzip_xml('GOE/AGA/00000/base/tokens_conservative.xml')
124 ->attr_is('spanList span:nth-child(1)', 'to', 8)
Akron2a60c532020-02-13 15:52:18 +0100125
Akron044bd922020-07-30 09:12:28 +0200126 ->attr_is('spanList span#t_1', 'from', 9)
127 ->attr_is('spanList span#t_1', 'to', 11)
Akron797e8072020-02-13 07:59:40 +0100128
Akron044bd922020-07-30 09:12:28 +0200129 ->attr_is('spanList span#t_67', 'from', 427)
130 ->attr_is('spanList span#t_67', 'to', 430)
Akroneac374d2020-07-07 09:00:44 +0200131
Akron044bd922020-07-30 09:12:28 +0200132 ->attr_is('spanList span#t_214', 'from', 1209)
133 ->attr_is('spanList span#t_214', 'to', 1212)
Akroneac374d2020-07-07 09:00:44 +0200134
Akron044bd922020-07-30 09:12:28 +0200135 ->element_count_is('spanList span', 227);
136};
Akroneac374d2020-07-07 09:00:44 +0200137
Akroneac374d2020-07-07 09:00:44 +0200138
Akron044bd922020-07-30 09:12:28 +0200139subtest 'Tokenize with external tokenizer' => sub {
Akroneac374d2020-07-07 09:00:44 +0200140
Akron044bd922020-07-30 09:12:28 +0200141 my $cmd = catfile($f, 'cmd', 'tokenizer.pl');
Akroneac374d2020-07-07 09:00:44 +0200142
Akron044bd922020-07-30 09:12:28 +0200143 test_tei2korapxml(
144 file => $file,
145 param => "-tc='perl $cmd'",
146 tmp => 'script_out2'
147 )
148 ->stderr_like(qr!tei2korapxml: .*? text_id=GOE_AGA\.00000!)
149 ->file_readable('GOE/AGA/00000/base/tokens.xml')
Akroneac374d2020-07-07 09:00:44 +0200150
Akron044bd922020-07-30 09:12:28 +0200151 # Uncompress GOE/AGA/00000/base/tokens.xml from zip file
152 ->unzip_xml('GOE/AGA/00000/base/tokens.xml')
153 ->attr_is('spanList span:nth-child(1)', 'to', 8)
154 ->attr_is('spanList span#t_1', 'from', 9)
155 ->attr_is('spanList span#t_1', 'to', 11)
156 ->attr_is('spanList span#t_67', 'from', 427)
157 ->attr_is('spanList span#t_67', 'to', 430)
158 ->attr_is('spanList span#t_214', 'from', 1209)
159 ->attr_is('spanList span#t_214', 'to', 1212)
160 ->element_count_is('spanList span', 227);
161};
Akroneac374d2020-07-07 09:00:44 +0200162
163
Akron044bd922020-07-30 09:12:28 +0200164subtest 'Test Tokenizations' => sub {
Akroneac374d2020-07-07 09:00:44 +0200165
Akron044bd922020-07-30 09:12:28 +0200166 my $t = test_tei2korapxml(
167 file => catfile($f, 'data', 'text_with_blanks.i5.xml'),
168 tmp => 'script_out3',
169 param => '-ti'
170 )->stderr_like(qr!tei2korapxml: .*? text_id=CORP_DOC.00001!);
Akron8b511f92020-07-09 17:28:08 +0200171
Akron044bd922020-07-30 09:12:28 +0200172 # ~ test conservative tokenization ~
173 $t->unzip_xml('CORP/DOC/00001/base/tokens_conservative.xml')
174 ->attr_is('spanList span:nth-child(1)', 'to', 6)
Akron8b511f92020-07-09 17:28:08 +0200175
Akron044bd922020-07-30 09:12:28 +0200176 ->attr_is('spanList span#t_1', 'from', 7)
177 ->attr_is('spanList span#t_1', 'to', 9)
Akron8b511f92020-07-09 17:28:08 +0200178
Akron044bd922020-07-30 09:12:28 +0200179 ->attr_is('spanList span#t_3', 'from', 12)
180 ->attr_is('spanList span#t_3', 'to', 16)
Akron8b511f92020-07-09 17:28:08 +0200181
Akron044bd922020-07-30 09:12:28 +0200182 ->attr_is('spanList span#t_9', 'from', 36)
183 ->attr_is('spanList span#t_9', 'to', 37)
Akron8b511f92020-07-09 17:28:08 +0200184
Akron044bd922020-07-30 09:12:28 +0200185 ->attr_is('spanList span#t_13', 'from', 44)
186 ->attr_is('spanList span#t_13', 'to', 45) # "
Akron8b511f92020-07-09 17:28:08 +0200187
Akron044bd922020-07-30 09:12:28 +0200188 ->attr_is('spanList span#t_14', 'from', 45) # twenty-two
189 ->attr_is('spanList span#t_14', 'to', 55)
Peter Harders42e18a62020-07-21 02:43:26 +0200190
Akron044bd922020-07-30 09:12:28 +0200191 ->attr_is('spanList span#t_15', 'from', 55) # "
192 ->attr_is('spanList span#t_15', 'to', 56)
Akron8b511f92020-07-09 17:28:08 +0200193
Akron044bd922020-07-30 09:12:28 +0200194 ->attr_is('spanList span#t_19', 'from', 66)
195 ->attr_is('spanList span#t_19', 'to', 67)
Peter Hardersb1227172020-07-21 02:12:10 +0200196
Akron044bd922020-07-30 09:12:28 +0200197 ->element_count_is('spanList span', 20);
Peter Harders71f072b2020-07-15 14:15:01 +0200198
Peter Harders71f072b2020-07-15 14:15:01 +0200199
Akron044bd922020-07-30 09:12:28 +0200200 # ~ test aggressive tokenization ~
201 $t->unzip_xml('CORP/DOC/00001/base/tokens_aggressive.xml')
202 ->attr_is('spanList span:nth-child(1)', 'to', 6)
Peter Harders71f072b2020-07-15 14:15:01 +0200203
Akron044bd922020-07-30 09:12:28 +0200204 ->attr_is('spanList span#t_1', 'from', 7)
205 ->attr_is('spanList span#t_1', 'to', 9)
Peter Harders71f072b2020-07-15 14:15:01 +0200206
Akron044bd922020-07-30 09:12:28 +0200207 ->attr_is('spanList span#t_3', 'from', 12)
208 ->attr_is('spanList span#t_3', 'to', 16)
Peter Harders71f072b2020-07-15 14:15:01 +0200209
Akron044bd922020-07-30 09:12:28 +0200210 ->attr_is('spanList span#t_9', 'from', 36)
211 ->attr_is('spanList span#t_9', 'to', 37)
Peter Harders71f072b2020-07-15 14:15:01 +0200212
Akron044bd922020-07-30 09:12:28 +0200213 ->attr_is('spanList span#t_13', 'from', 44)
214 ->attr_is('spanList span#t_13', 'to', 45) # "
Peter Harders71f072b2020-07-15 14:15:01 +0200215
Akron044bd922020-07-30 09:12:28 +0200216 ->attr_is('spanList span#t_14', 'from', 45) # twenty
217 ->attr_is('spanList span#t_14', 'to', 51)
Peter Harders71f072b2020-07-15 14:15:01 +0200218
Akron044bd922020-07-30 09:12:28 +0200219 ->attr_is('spanList span#t_15', 'from', 51) # -
220 ->attr_is('spanList span#t_15', 'to', 52)
Peter Harders71f072b2020-07-15 14:15:01 +0200221
Akron044bd922020-07-30 09:12:28 +0200222 ->attr_is('spanList span#t_16', 'from', 52) # two
223 ->attr_is('spanList span#t_16', 'to', 55)
Peter Harders71f072b2020-07-15 14:15:01 +0200224
Akron044bd922020-07-30 09:12:28 +0200225 ->attr_is('spanList span#t_17', 'from', 55) # "
226 ->attr_is('spanList span#t_17', 'to', 56)
Peter Harders71f072b2020-07-15 14:15:01 +0200227
Akron044bd922020-07-30 09:12:28 +0200228 ->attr_is('spanList span#t_21', 'from', 66)
229 ->attr_is('spanList span#t_21', 'to', 67)
Peter Harders71f072b2020-07-15 14:15:01 +0200230
Akron044bd922020-07-30 09:12:28 +0200231 ->element_count_is('spanList span', 22);
232};
Peter Harders71f072b2020-07-15 14:15:01 +0200233
234
Peter Harders42e18a62020-07-21 02:43:26 +0200235subtest 'Check Tokenization Flags' => sub {
236
237 # Get external tokenizer
238 my $f = dirname(__FILE__);
239 my $cmd = catfile($f, 'cmd', 'tokenizer.pl');
240
241 # Load example file
Akron044bd922020-07-30 09:12:28 +0200242 test_tei2korapxml(
243 file => catfile($f, 'data', 'goe_sample.i5.xml'),
244 param => "-ti -tc 'perl $cmd'",
245 tmp => 'script_tokflags'
246 )
247 ->stderr_like(qr!tei2korapxml: .*? text_id=GOE_AGA\.00000!)
248 ->file_exists('GOE/AGA/00000/base/tokens_aggressive.xml')
249 ->file_exists('GOE/AGA/00000/base/tokens_conservative.xml')
250 ->file_exists('GOE/AGA/00000/base/tokens.xml')
251 ;
Peter Harders42e18a62020-07-21 02:43:26 +0200252};
253
Peter Harders1c5ce152020-07-22 18:02:50 +0200254
255subtest 'Test utf-8 handling' => sub {
Peter Harders1c5ce152020-07-22 18:02:50 +0200256 # Introduce invalid utf-8 characters
257 my $text_sigle;
Akron54e363c2020-07-29 11:01:03 +0200258 {
259 no warnings;
260 # $text_sigle printed to file, without encoding: Aþƒ¿¿¿¿¿A_Bþƒ¿¿¿¿¿B.Cþƒ¿¿¿¿¿C
261 # the utf8-sequence 'þƒ¿¿¿¿¿' encodes 32 bit of data (see 0x7FFF_FFFF in perlunicode)
262 $text_sigle = "A\x{FFFF_FFFF}A_B\x{FFFF_FFFF}B.C\x{FFFF_FFFF}C"
263 }
264 # If CHECK is 0, encoding and decoding replace any malformed character
265 # with a substitution character.
Peter Harders1c5ce152020-07-22 18:02:50 +0200266 # � = substitution character
267 my $text_sigle_lax = encode_utf8($text_sigle);
268 my $text_sigle_esc = encode('UTF-8', $text_sigle);
269
270 is(length($text_sigle), 11); # A�A_B�B.C�C (char string => length(�) = 1)
271 is(length($text_sigle_lax), 29); # Aþƒ¿¿¿¿¿A_Bþƒ¿¿¿¿¿B.Cþƒ¿¿¿¿¿C (byte string)
272 is(length($text_sigle_esc), 17); # A�A_B�B.C�C (byte string => length(�) = 3)
273
Akron54e363c2020-07-29 11:01:03 +0200274
275 my $tpl;
276 {
277 no warnings;
278 $tpl = i5_template(
279 korpusSigle => "A\x{FFFF_FFFF}A",
280 dokumentSigle => "A\x{FFFF_FFFF}A_B\x{FFFF_FFFF}B",
281 text => "<p>d\x{FFFF_FFFF}d e\x{FFFF_FFFF}e f\x{FFFF_FFFF}f</p>",
282 textSigle => $text_sigle
283 );
284 };
Peter Harders1c5ce152020-07-22 18:02:50 +0200285
286 my ($fh, $tplfile) = korap_tempfile('script_out4');
287 binmode($fh);
288 print $fh encode_utf8($tpl); # => text_id=Aþƒ¿¿¿¿¿A_Bþƒ¿¿¿¿¿B.Cþƒ¿¿¿¿¿C
289 close($fh);
290
291 my (undef, $outzip) = korap_tempfile('script_out5');
292
Akron54e363c2020-07-29 11:01:03 +0200293 # because output 'textid=...' goes to STDERR (see script/tei2korapxml)
294 binmode STDERR, qw{ :encoding(UTF-8) };
Peter Harders1c5ce152020-07-22 18:02:50 +0200295
296 stderr_like(
297 sub { `cat '$tplfile' | perl '$script' -ti > '$outzip'` },
298 qr!tei2korapxml: .*? text_id=$text_sigle_lax!, # see above: print $fh encode_utf8($tpl);
299 );
300};
301
Akrone68ec0c2020-07-28 18:06:19 +0200302
303subtest 'Check Inline annotations' => sub {
304
305 # Load example file
306 my $file = catfile($f, 'data', 'goe_sample_tagged.i5.xml');
307
Akron044bd922020-07-30 09:12:28 +0200308 my $t = test_tei2korapxml(
309 file => $file,
310 env => 'KORAPXMLTEI_INLINE=1',
311 tmp => 'script_tagged'
312 )
313 ->stderr_like(qr!tei2korapxml: .*? text_id=GOE_AGA\.00000!)
Akrone68ec0c2020-07-28 18:06:19 +0200314
Akron044bd922020-07-30 09:12:28 +0200315 # Check zip using xml loy
316 ->unzip_xml('GOE/AGA/00000/tokens/morpho.xml')
Akrone68ec0c2020-07-28 18:06:19 +0200317
Akron044bd922020-07-30 09:12:28 +0200318 ->attr_is('layer', 'docid', 'GOE_AGA.00000')
Akrone68ec0c2020-07-28 18:06:19 +0200319 ->attr_is('spanList span:nth-child(1)', 'id', 's0')
320 ->attr_is('spanList span:nth-child(1)', 'from', '75')
321 ->attr_is('spanList span:nth-child(1)', 'to', '81')
322 ->attr_is('spanList span:nth-child(1)', 'l', '7')
323
324 ->attr_is('span#s0 > fs', 'type', 'lex')
325 ->attr_is('span#s0 > fs', 'xmlns', 'http://www.tei-c.org/ns/1.0')
326 ->attr_is('span#s0 > fs > f > fs > f:nth-child(1)', 'name', 'pos')
327 ->text_is('span#s0 > fs > f > fs > f:nth-child(1)', 'A')
328 ->attr_is('span#s0 > fs > f > fs > f:nth-child(2)', 'name', 'msd')
329 ->text_is('span#s0 > fs > f > fs > f:nth-child(2)', '@NH')
330
331 ->attr_is('span#s25', 'from', '259')
332 ->attr_is('span#s25', 'to', '263')
333 ->attr_is('span#s25', 'l', '7')
334 ->attr_is('span#s25 > fs > f > fs > f:nth-child(1)', 'name', 'pos')
335 ->text_is('span#s25 > fs > f > fs > f:nth-child(1)', 'PRON')
336 ->attr_is('span#s25 > fs > f > fs > f:nth-child(2)', 'name', 'msd')
337 ->text_is('span#s25 > fs > f > fs > f:nth-child(2)', '@NH')
338
339 ->attr_is('span#s58', 'from', '495')
340 ->attr_is('span#s58', 'to', '500')
341 ->attr_is('span#s58', 'l', '7')
342 ->attr_is('span#s58 > fs > f > fs > f:nth-child(1)', 'name', 'pos')
343 ->text_is('span#s58 > fs > f > fs > f:nth-child(1)', 'N')
344 ->attr_is('span#s58 > fs > f > fs > f:nth-child(2)', 'name', 'msd')
345 ->text_is('span#s58 > fs > f > fs > f:nth-child(2)', '@NH')
346
347 ->attr_is('span#s119', 'from', '914')
348 ->attr_is('span#s119', 'to', '925')
349 ->attr_is('span#s119', 'l', '7')
350 ->attr_is('span#s119 > fs > f > fs > f:nth-child(1)', 'name', 'pos')
351 ->text_is('span#s119 > fs > f > fs > f:nth-child(1)', 'A')
352 ->attr_is('span#s119 > fs > f > fs > f:nth-child(2)', 'name', 'msd')
353 ->text_is('span#s119 > fs > f > fs > f:nth-child(2)', '@NH')
354 ->element_exists_not('span#s120')
355 ;
356};
357
Akron09e0b2c2020-07-28 15:57:01 +0200358subtest 'Check Inline annotations with untagged file' => sub {
359
360 # Load example file
361 my $file = catfile($f, 'data', 'goe_sample.i5.xml');
362
363 my ($fh, $outzip) = korap_tempfile('script_untagged');
364
365 # Generate zip file (unportable!)
366 stderr_like(
367 sub { `cat '$file' | KORAPXMLTEI_INLINE=1 perl '$script' > '$outzip'` },
368 qr!tei2korapxml: .*? text_id=GOE_AGA\.00000!,
369 'Processing 1'
370 );
371
372 # TODO: there should be a better way to test this
373 stderr_unlike(
374 sub { `cat '$file' | KORAPXMLTEI_INLINE=1 perl '$script' > '$outzip'` },
375 qr!.*undefined value.*!,
376 'Processing 2'
377 );
378 #
379
380 ok(-e $outzip, "File $outzip exists");
381
382 my $zip = IO::Uncompress::Unzip->new(
383 $outzip,
384 Name => 'GOE/AGA/00000/tokens/morpho.xml'
385 );
386 ok((not $zip), 'missing morpho.xml');
387
388 $zip = IO::Uncompress::Unzip->new(
389 $outzip,
390 Name => 'GOE/AGA/00000/struct/structure.xml'
391 );
392 ok($zip, 'found structure.xml');
393};
Akrone68ec0c2020-07-28 18:06:19 +0200394
Akron3378dfd2020-08-01 15:01:36 +0200395
396subtest 'Test Log' => sub {
397 test_tei2korapxml(
398 tmp => 'script_out',
399 file => $file,
400 param => '-l=warn'
401 )->stderr_is('');
402};
403
404
Akron797e8072020-02-13 07:59:40 +0100405done_testing;