Akron | 4f67cd4 | 2020-07-02 12:27:58 +0200 | [diff] [blame] | 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More; |
| 4 | use File::Temp 'tempfile'; |
| 5 | |
| 6 | use FindBin; |
| 7 | BEGIN { |
| 8 | unshift @INC, "$FindBin::Bin/../lib"; |
| 9 | }; |
| 10 | |
| 11 | require_ok('KorAP::XML::TEI'); |
| 12 | |
| 13 | my ($fh, $filename) = tempfile(); |
| 14 | |
| 15 | print $fh <<'HTML'; |
| 16 | mehrzeiliger |
| 17 | Kommentar |
| 18 | --> |
| 19 | Test |
| 20 | HTML |
| 21 | |
| 22 | is(KorAP::XML::TEI::delHTMLcom($fh, "hallo"),"hallo"); |
| 23 | is(KorAP::XML::TEI::delHTMLcom($fh, "hallo <!-- Test -->"),"hallo "); |
| 24 | is(KorAP::XML::TEI::delHTMLcom($fh, "<!-- Test --> hallo")," hallo"); |
| 25 | |
| 26 | seek($fh, 0, 0); |
| 27 | |
| 28 | is(KorAP::XML::TEI::delHTMLcom($fh, '<!--'), "Test\n"); |
| 29 | |
Akron | 2d547bc | 2020-07-04 10:34:35 +0200 | [diff] [blame] | 30 | seek($fh, 0, 0); |
| 31 | |
| 32 | print $fh <<'HTML'; |
| 33 | mehrzeiliger |
| 34 | Kommentar |
| 35 | --><!-- Versuch |
| 36 | -->ist <!-- a --><!-- b --> ein Test |
| 37 | HTML |
| 38 | |
| 39 | seek($fh, 0, 0); |
| 40 | |
Akron | 7fab93b | 2020-07-04 11:14:21 +0200 | [diff] [blame] | 41 | is(KorAP::XML::TEI::delHTMLcom($fh, 'Dies <!--'), "Dies ist ein Test\n"); |
Akron | 2d547bc | 2020-07-04 10:34:35 +0200 | [diff] [blame] | 42 | |
| 43 | close($fh); |
| 44 | |
Akron | 4f67cd4 | 2020-07-02 12:27:58 +0200 | [diff] [blame] | 45 | done_testing; |