blob: 53f372e3217704d84ecff72725c71be315e95597 [file] [log] [blame]
Akron4f67cd42020-07-02 12:27:58 +02001use strict;
2use warnings;
3use Test::More;
Akron5fb5e8d2020-07-23 17:45:13 +02004use Test::KorAP::XML::TEI qw!korap_tempfile!;
Akron4f67cd42020-07-02 12:27:58 +02005
6use FindBin;
7BEGIN {
8 unshift @INC, "$FindBin::Bin/../lib";
9};
10
Akron95bc98a2020-07-11 12:00:12 +020011use_ok('KorAP::XML::TEI', 'remove_xml_comments');
Akron4f67cd42020-07-02 12:27:58 +020012
Akron5fb5e8d2020-07-23 17:45:13 +020013my ($fh, $filename) = korap_tempfile('tei');
Akron4f67cd42020-07-02 12:27:58 +020014
15print $fh <<'HTML';
16mehrzeiliger
17Kommentar
18 -->
19Test
20HTML
21
Akron95bc98a2020-07-11 12:00:12 +020022is(remove_xml_comments($fh, "hallo"),"hallo");
23is(remove_xml_comments($fh, "hallo <!-- Test -->"),"hallo ");
24is(remove_xml_comments($fh, "<!-- Test --> hallo")," hallo");
Akron4f67cd42020-07-02 12:27:58 +020025
26seek($fh, 0, 0);
27
Akron95bc98a2020-07-11 12:00:12 +020028is(remove_xml_comments($fh, '<!--'), "Test\n");
Akron4f67cd42020-07-02 12:27:58 +020029
Akron2d547bc2020-07-04 10:34:35 +020030seek($fh, 0, 0);
31
32print $fh <<'HTML';
33mehrzeiliger
34Kommentar
35 --><!-- Versuch
36-->ist <!-- a --><!-- b --> ein Test
37HTML
38
39seek($fh, 0, 0);
40
Akron95bc98a2020-07-11 12:00:12 +020041is(remove_xml_comments($fh, 'Dies <!--'), "Dies ist ein Test\n");
Akron2d547bc2020-07-04 10:34:35 +020042
43close($fh);
44
Akron4f67cd42020-07-02 12:27:58 +020045done_testing;