X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-CGI-Ex;a=blobdiff_plain;f=t%2F1_validate_03_cgi.t;h=a6e41531be6c5116c545c878a68e00066438642c;hp=32dff8f2e9332462790cdfe75df0fdf1765ac5d1;hb=4eee158dce82376f2f37de29d91c53f60a24aebe;hpb=85070b46d0a93ddbeef07341421adb8389a55418 diff --git a/t/1_validate_03_cgi.t b/t/1_validate_03_cgi.t index 32dff8f..a6e4153 100644 --- a/t/1_validate_03_cgi.t +++ b/t/1_validate_03_cgi.t @@ -1,34 +1,41 @@ # -*- Mode: Perl; -*- +=head1 NAME + +1_validate_03_cgi.t - Test CGI::Ex::Validate's ability to interact with CGI.pm. + +=cut + use strict; +use Test::More tests => 3; -$^W = 1; +use_ok('CGI::Ex::Validate'); -print "1..2\n"; +SKIP: { + skip("CGI.pm not installed", 2) if ! eval { require CGI }; -use CGI::Ex; -use CGI; + my $form = CGI->new({ + user => 'abc', + pass => '123', + }); + my $val = { + user => { + required => 1, + }, + pass => { + required => 1, + }, + }; -print "ok 1\n"; + my $err_obj = CGI::Ex::Validate::validate($form,$val); + ok(! $err_obj, "Correctly didn't get an error object"); -my $form = CGI->new({ - user => 'abc', - pass => '123', -}); -my $val = { - user => { - required => 1, - }, - pass => { - required => 1, - }, -}; + $form = CGI->new({ + user => 'abc', + #pass => '123', + }); -my $err_obj = CGI::Ex->new->validate($form,$val); + $err_obj = CGI::Ex::Validate::validate($form, $val); + ok($err_obj, "Correctly did get an error object"); -if (! $err_obj) { - print "ok 2\n"; -} else { - warn "$err_obj\n"; - print "not ok 2\n"; }