File: 04-between.t

package info (click to toggle)
libvalidation-class-perl 7.900059-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,480 kB
  • sloc: perl: 21,493; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use Test::More tests => 3;

package MyVal;
use Validation::Class;

package main;

my $r = MyVal->new(
    fields => {foobar => {between => '2-5'}},
    params => {foobar => 3}
);

ok $r->validate(), 'foobar validates';
$r->params->{foobar} = 8;

ok !$r->validate(), 'foobar doesnt validate';
ok 'foobar must be between 2-5' eq $r->errors_to_string(),
  'displays proper error message';

#warn $r->errors_to_string();