7 ### determine number of tests
9 my $prog = join "", <DATA>;
10 my @tests = ($prog =~ /&print_ok\(/g);
14 require CGI::Ex::Validate;
16 my ($N, $v, $e, $ok) = (0);
19 return scalar &CGI::Ex::Validate::validate(@_);
24 warn "Test failed at line ".(caller)[2]."\n" if ! $ok;
25 print "" . ($ok ? "" : "not ") . "ok $N\n";
29 ###----------------------------------------------------------------###
31 ### where are my samples
33 $dir =~ tr|\\|/|; # should probably use File::Spec
34 $dir =~ s|[^/]+$|samples| || die "Couldn't determine dir";
35 $dir =~ s|^t/|./t/|; # to satisfy conf
38 $v = "$dir/html1.htm";
40 $e = &validate({}, $v);
42 $e = &validate({user => 1}, $v);
44 $e = &validate({user => 1, bar => 1}, $v);
46 $e = &validate({user => 1, bar => 1, foo => 1}, $v);
50 ### three groups, some with validate_if's - using arrayref
51 $v = "$dir/html2.htm";
53 $e = &validate({}, $v);
55 $e = &validate({user => 1}, $v);
57 $e = &validate({user => 1, bar => 1}, $v);
59 $e = &validate({user => 1, bar => 1, foo => 1}, $v);