EscapeHTML function
[perl/plp/.git] / t / 10-functions.t
1 use strict;
2
3 use Test::More tests => 6;
4
5 BEGIN { use_ok('PLP::Functions') }
6
7 # legacy
8
9 is(
10         Entity(q{<a test="'&'"/>}),
11         "&lt;a test=&quot;'&amp;'&quot;/&gt;",
12         'Entity escaping'
13 );
14
15 is(
16         Entity(" . .  .   .\t. \n"),
17         " . .&nbsp;&nbsp;.&nbsp;&nbsp; .&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;. <br>\n",
18         'Entity formatting'
19 );
20
21 is(
22         EncodeURI("/test.plp?f00=~_a&b!\n "),
23         '/test.plp?f00%3d~_a%26b!%0a%20',
24         'EncodeURI'
25 );
26
27 is(
28         DecodeURI('?f0%30+%20b%61r!'),
29         '?f00  bar!',
30         'DecodeURI'
31 );
32
33 is(
34         DecodeURI('%0A%0a%a %000 %fg%%fF'."\377"),
35         "\n\n%a \0000 %fg%\377\377",
36         'DecodeURI 2'
37 );
38