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/storable1.storable";
40 ### don't use the included binary - write our own - for portable tests
49 &print_ok(eval {require Storable});
50 &print_ok(&Storable::store($val, $v));
52 $e = &validate({}, $v);
54 $e = &validate({user => 1}, $v);
56 $e = &validate({user => 1, bar => 1}, $v);
58 $e = &validate({user => 1, bar => 1, foo => 1}, $v);