2 # Copyright (C) 2010, Parrot Foundation.
11 Test the URI Escape library
15 % prove t/library/uri_escape.t
20 .include 'test_more.pir'
22 load_bytecode 'URI/Escape.pbc'
26 $P0 = new ['Exporter']
27 $P1 = get_namespace ['URI'; 'Escape']
29 $P0.'import'($P1 :named('source'), $P2 :named('destination'), 'percent_encode percent_encode_component' :named('globals'))
31 $S0 = percent_encode('Hello')
32 is($S0, 'Hello', 'plain ascii without special chars')
34 $S0 = percent_encode_component('Hello')
35 is($S0, 'Hello', 'plain ascii without special chars - component')
37 $S0 = percent_encode('Hello?world')
38 is($S0, 'Hello?world', 'plain ascii')
40 $S1 = percent_encode_component('Hello?world')
41 is($S1, 'Hello%3Fworld', 'plain ascii - component')
43 $S0 = percent_encode(iso-8859-1:"A\x{D1}O#a")
44 is($S0, 'A%C3%91O#a', 'iso-8859-1 string')
46 $S0 = percent_encode_component(iso-8859-1:"A\x{D1}O#a")
47 is($S0, 'A%C3%91O%23a', 'iso-8859-1 string - component')
54 # vim: expandtab shiftwidth=4 ft=pir: