File: rename_builtin_constraints.t

package info (click to toggle)
libdata-formvalidator-perl 4.70-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 676 kB
  • sloc: perl: 2,839; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (3)
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
#!perl
use Test::More 'no_plan';

use Data::FormValidator;
use Data::FormValidator::Constraints qw( 
    FV_max_length 
);

my $result = Data::FormValidator->check({
         first_names => 'Too long',   
    },
    {
        required => [qw/first_names/],
        constraint_methods => {
            first_names =>  {
                constraint_method => FV_max_length(3),
                name => 'custom_length',
            }
        },
        msgs => {
            constraints => {
                custom_length => 'Custom length msg',
            }
        },
    });

like( $result->msgs->{'first_names'}, qr/Custom length msg/, "built-ins can have custom names" );