From 123b0af80086cfc59726208a2cb390b6532f5036 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 31 Mar 2007 02:59:40 +0200 Subject: [PATCH] add tests for all quoting functions --- test.pl | 56 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/test.pl b/test.pl index ee6478e..a6c6e92 100644 --- a/test.pl +++ b/test.pl @@ -1,20 +1,38 @@ - -# TODO - Write tests. - -# Before `make install' is performed this script should be runnable with -# `make test'. After `make install' it should work as `perl test.pl' - -######################### - -# change 'tests => 1' to 'tests => last_test_to_print'; - -use Test; -BEGIN { plan tests => 1 }; -use PLP; -ok(1); # If we made it this far, we're ok. - -######################### - -# Insert your test code below, the Test module is use()ed here so read -# its man page ( perldoc Test ) for help writing this test script. +use strict; + +use Test::More tests => 6; + +BEGIN { use_ok('PLP') } + +PLP::Functions->import(); + +is( + Entity(q{}), + "<a test="'&'"/>", + 'Entity escaping' +); + +is( + Entity(" . . . .\t. \n"), + " . .  .   .        .
\n", + 'Entity formatting' +); + +is( + EncodeURI("/test.plp?f00=~_a&b!\n "), + '/test.plp?f00%3d~_a%26b!%0a%20', + 'EncodeURI' +); + +is( + DecodeURI('?f0%30+%20b%61r!'), + '?f00 bar!', + 'DecodeURI' +); + +is( + DecodeURI('%0A%0a%a %000 %fg%%fF'."\377"), + "\n\n%a \0000 %fg%\377\377", + 'DecodeURI 2' +); -- 2.30.0