| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use utf8; |
| 4 |
|
| 5 |
use Markdown::Perl::HTML ':all'; |
| 6 |
use Test2::V0; |
| 7 |
|
| 8 |
is(decode_entities('©'), '©', 'html_entity_name1'); |
| 9 |
is(decode_entities('“'), '“', 'html_entity_name2'); |
| 10 |
is(decode_entities('©'), '©', 'not_html_entity_name1'); |
| 11 |
is(decode_entities('copy;'), 'copy;', 'not_html_entity_name2'); |
| 12 |
is(decode_entities('&unknownEntity;'), '&unknownEntity;', 'not_html_entity_name3'); |
| 13 |
|
| 14 |
is(decode_entities('A'), 'A', 'html_numeric_entity1'); |
| 15 |
is(decode_entities('�'), "\x{fffd}", 'html_numeric_entity2'); |
| 16 |
is(decode_entities('&#;'), "&#;", 'no_html_numeric_entity1'); |
| 17 |
is(decode_entities('�'), "�", 'no_html_numeric_entity1'); |
| 18 |
|
| 19 |
is(decode_entities('A'), 'A', 'html_hex_entity1'); |
| 20 |
is(decode_entities('A'), 'A', 'html_hex_entity2'); |
| 21 |
is(decode_entities('&#;'), "&#;", 'no_html_hex_entity1'); |
| 22 |
is(decode_entities('�'), "�", 'no_html_hex_entity2'); |
| 23 |
|
| 24 |
{ |
| 25 |
my $html = '<test>'; |
| 26 |
remove_disallowed_tags($html, [qw(foo bar)]); |
| 27 |
is($html, '<test>', 'remove_disallowed_tags1'); |
| 28 |
remove_disallowed_tags($html, [qw(foo bar test)]); |
| 29 |
is($html, '<test>', 'remove_disallowed_tags2'); |
| 30 |
} |
| 31 |
done_testing; |