X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Fliburi-perl%2Fliburi-perl-1.35.dfsg.1%2Ft%2Fescape.t;fp=dev%2Fi386%2Fliburi-perl%2Fliburi-perl-1.35.dfsg.1%2Ft%2Fescape.t;h=daebd9df6b53e691ac1802b12db55a2f0f04df2f;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/liburi-perl/liburi-perl-1.35.dfsg.1/t/escape.t b/dev/i386/liburi-perl/liburi-perl-1.35.dfsg.1/t/escape.t new file mode 100644 index 0000000..daebd9d --- /dev/null +++ b/dev/i386/liburi-perl/liburi-perl-1.35.dfsg.1/t/escape.t @@ -0,0 +1,48 @@ +#!perl -w + +print "1..9\n"; + +use URI::Escape; + +print "not " unless uri_escape("|abcå") eq "%7Cabc%E5"; +print "ok 1\n"; + +print "not " unless uri_escape("abc", "b-d") eq "a%62%63"; +print "ok 2\n"; + +print "not " if defined(uri_escape(undef)); +print "ok 3\n"; + +print "not " unless uri_unescape("%7Cabc%e5") eq "|abcå"; +print "ok 4\n"; + +print "not " unless join(":", uri_unescape("%40A%42", "CDE", "F%47H")) eq + '@AB:CDE:FGH'; +print "ok 5\n"; + + +use URI::Escape qw(%escapes); + +print "not" unless $escapes{"%"} eq "%25"; +print "ok 6\n"; + + +use URI::Escape qw(uri_escape_utf8); + +print "not " unless uri_escape_utf8("|abcå") eq "%7Cabc%C3%A5"; +print "ok 7\n"; + +if ($] < 5.008) { + print "ok 8 # skip perl-5.8 required\n"; + print "ok 9 # skip perl-5.8 required\n"; +} +else { + eval { print uri_escape("abc" . chr(300)) }; + print "not " unless $@ && $@ =~ /^Can\'t escape \\x{012C}, try uri_escape_utf8\(\) instead/; + print "ok 8\n"; + + print "not " unless uri_escape_utf8(chr(0xFFF)) eq "%E0%BF%BF"; + print "ok 9\n"; +} + +