10
[ ''', ''' ],
11
[ '&', '&' ],
12
[ '&', '&' ],
14
[ '穩', '穩' ],
15
[ 'ő', 'ő' ],
16
[ '', '' ],
17
[ '', '' ],
18
[ '', '' ],
19
[ '', '' ],
21
[ '&Foo3;', '&Foo3;' ],
33
my ($in, $out) = @$pair;
35
push @tests, [ $in, $out ];
36
push @tests, [ $out, $out ];
39
push @tests, [ "&#$dec;", $out ];
40
push @tests, [ "�$dec;", $out ];
41
push @tests, [ "�$dec;", $out ];
43
my $hex = sprintf '%x', $dec;
44
push @tests, [ "&#x$hex;", $out ];
45
push @tests, [ "&#X$hex;", $out ];
46
push @tests, [ "�$hex;", $out ];
47
push @tests, [ "�$hex;", $out ];
48
push @tests, [ "�$hex;", $out ];
49
push @tests, [ "�$hex;", $out ];
51
if ($hex =~ /[a-f]/) {
53
push @tests, [ "&#x$hex;", $out ];
54
push @tests, [ "&#X$hex;", $out ];
55
push @tests, [ "�$hex;", $out ];
56
push @tests, [ "�$hex;", $out ];
57
push @tests, [ "�$hex;", $out ];
58
push @tests, [ "�$hex;", $out ];
64
use Test::More tests => 4 * scalar(@tests);
66
use HTML::StripScripts;
67
my $f = HTML::StripScripts->new;
69
foreach my $test (@tests) {
70
my ($in, $out) = @$test;
72
$f->input_start_document;
74
$f->input_end_document;
75
is( $f->filtered_document, $out, "text input [$in]" );
77
$f->input_start_document;
78
$f->input_text("=$in=");
79
$f->input_end_document;
80
is( $f->filtered_document, "=$out=", "text input [=$in=]" );
85
$f->input_start_document;
86
$f->input_start(qq{<img alt="$esc">});
87
$f->input_end_document;
88
is( $f->filtered_document, qq{<img alt="$out" />}, "img alt input [$in]" );
90
$f->input_start_document;
91
$f->input_start(qq{<img alt="=$esc=">});
92
$f->input_end_document;
93
is( $f->filtered_document, qq{<img alt="=$out=" />}, "img alt input [=$in=]" );