From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

use strict;
use utf8;
is(decode_entities('©'), '©', 'html_entity_name1');
is(decode_entities('“'), '“', 'html_entity_name2');
is(decode_entities('&copy'), '&copy', 'not_html_entity_name1');
is(decode_entities('copy;'), 'copy;', 'not_html_entity_name2');
is(decode_entities('&unknownEntity;'), '&unknownEntity;', 'not_html_entity_name3');
is(decode_entities('A'), 'A', 'html_numeric_entity1');
is(decode_entities('�'), "\x{fffd}", 'html_numeric_entity2');
is(decode_entities('&#;'), "&#;", 'no_html_numeric_entity1');
is(decode_entities('�'), "�", 'no_html_numeric_entity1');
is(decode_entities('A'), 'A', 'html_hex_entity1');
is(decode_entities('A'), 'A', 'html_hex_entity2');
is(decode_entities('&#;'), "&#;", 'no_html_hex_entity1');
is(decode_entities('�'), "�", 'no_html_hex_entity2');
{
my $html = '<test>';
remove_disallowed_tags($html, [qw(foo bar)]);
is($html, '<test>', 'remove_disallowed_tags1');
remove_disallowed_tags($html, [qw(foo bar test)]);
is($html, '&lt;test>', 'remove_disallowed_tags2');
}
done_testing;