]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - t/1_validate_03_cgi.t
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / t / 1_validate_03_cgi.t
index 32dff8f2e9332462790cdfe75df0fdf1765ac5d1..a6e41531be6c5116c545c878a68e00066438642c 100644 (file)
@@ -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";
 }
This page took 0.019726 seconds and 4 git commands to generate.