c9213395440f738904383f5007afcd5b91eefc72
[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 is(
8         Entity(q{<a test="'&'"/>}),
9         "&lt;a test=&quot;'&amp;'&quot;/&gt;",
10         'Entity escaping'
11 );
12
13 is(
14         Entity(" . .  .   .\t. \n"),
15         " . .&nbsp;&nbsp;.&nbsp;&nbsp; .&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;. <br>\n",
16         'Entity formatting'
17 );
18
19 is(
20         EncodeURI("/test.plp?f00=~_a&b!\n "),
21         '/test.plp?f00%3d~_a%26b!%0a%20',
22         'EncodeURI'
23 );
24
25 is(
26         DecodeURI('?f0%30+%20b%61r!'),
27         '?f00  bar!',
28         'DecodeURI'
29 );
30
31 is(
32         DecodeURI('%0A%0a%a %000 %fg%%fF'."\377"),
33         "\n\n%a \0000 %fg%\377\377",
34         'DecodeURI 2'
35 );
36