Skip to content

Commit

Permalink
switched util.t to use Test::More
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Kuo committed Sep 4, 2009
1 parent 327c305 commit 4d5d568
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions t/util.t
Expand Up @@ -2,23 +2,12 @@

# Test ability to escape() and unescape() punctuation characters
# except for qw(- . _).
######################### We start with some black magic to print on failure.

BEGIN {$| = 1; print "1..57\n"; }
END {print "not ok 1\n" unless $loaded;}
use Config;
use CGI::Util qw(escape unescape);
$loaded = 1;
print "ok 1\n";

######################### End of black magic.
$| = 1;

# util
sub test {
local($^W) = 0;
my($num, $true,$msg) = @_;
print($true ? "ok $num\n" : "not ok $num $msg\n");
}
use Test::More tests => 57;
use Config;
use_ok ( 'CGI::Util', qw(escape unescape) );

# ASCII order, ASCII codepoints, ASCII repertoire

Expand All @@ -41,10 +30,10 @@ foreach(sort(keys(%punct))) {
$i++;
my $escape = "AbC\%$punct{$_}dEF";
my $cgi_escape = escape("AbC$_" . "dEF");
test($i, $escape eq $cgi_escape , "# $escape ne $cgi_escape");
is($escape, $cgi_escape , "# $escape ne $cgi_escape");
$i++;
my $unescape = "AbC$_" . "dEF";
my $cgi_unescape = unescape("AbC\%$punct{$_}dEF");
test($i, $unescape eq $cgi_unescape , "# $unescape ne $cgi_unescape");
is($unescape, $cgi_unescape , "# $unescape ne $cgi_unescape");
}

0 comments on commit 4d5d568

Please sign in to comment.