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