blob: f9b595972924a3498d1c30bf4d1edf83959638d4 [file] [log] [blame]
Akron4f67cd42020-07-02 12:27:58 +02001use strict;
2use warnings;
3use Test::More;
4use File::Temp 'tempfile';
5
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
13my ($fh, $filename) = tempfile();
14
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;