]> Dogcows Code - chaz/p5-CGI-Ex/blob - t/1_validate_00_base.t
add PSGI handler
[chaz/p5-CGI-Ex] / t / 1_validate_00_base.t
1 # -*- Mode: Perl; -*-
2
3 =head1 NAME
4
5 1_validate_00_base.t - Test CGI::Ex::Validate's ability to compile and execute
6
7 =cut
8
9 use strict;
10 use Test::More tests => 5;
11
12 use_ok('CGI::Ex::Validate');
13
14 my $form = {
15 user => 'abc',
16 pass => '123',
17 };
18 my $val = {
19 user => {
20 required => 1,
21 },
22 pass => {
23 required => 1,
24 },
25 };
26
27 my $err_obj = CGI::Ex::Validate::validate($form, $val);
28 ok(! $err_obj, "Basic function works");
29
30 ###----------------------------------------------------------------###
31
32 $form = {
33 user => 'abc',
34 # pass => '123',
35 };
36
37 $err_obj = CGI::Ex::Validate::validate($form,$val);
38
39 ok($err_obj, "Successfully failed");
40
41 ###----------------------------------------------------------------###
42
43 eval { CGI::Ex::Validate::validate($form,undef) };
44 ok($@, "Needs to have a hashref");
45
46 ###----------------------------------------------------------------###
47
48 $err_obj = CGI::Ex::Validate::validate($form,{});
49
50 ok(!$err_obj, "OK with empty hash");
This page took 0.029317 seconds and 4 git commands to generate.