File: 08_length.t

package info (click to toggle)
libformvalidator-simple-perl 0.29-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: perl: 3,043; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use strict;
use Test::More tests => 7;
use CGI;

BEGIN{ use_ok("FormValidator::Simple") }

my $q = CGI->new;
$q->param( text => 'text' );

my $r = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/,[qw/LENGTH 4/]],
] );

ok(!$r->invalid('text'));

my $r2 = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/,[qw/LENGTH 2 5/]],
] );

ok(!$r2->invalid('text'));

my $r3 = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/,[qw/LENGTH 5 7/]],
] );

ok($r3->invalid('text'));

my $r4 = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/, [qw/NOT_LENGTH 4/]],
] );

ok($r4->invalid('text'));

my $r5 = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/,[qw/NOT_LENGTH 2 5/]],
] );

ok($r5->invalid('text'));

my $r6 = FormValidator::Simple->check( $q => [
    text => [qw/NOT_BLANK/,[qw/NOT_LENGTH 5 7/]],
] );

ok(!$r6->invalid('text'));