File: 00_base.t

package info (click to toggle)
libdata-formvalidator-perl 4.66-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 588 kB
  • ctags: 127
  • sloc: perl: 2,756; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 797 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

use Test::More tests => 5;

BEGIN {
  use_ok('Data::FormValidator');
}

my $dfv;
eval { $dfv = Data::FormValidator->new({}, 'wrong'); };
like ($@, qr/must be a hash ref/, 'second argument must be a hash ref or die');

eval { 
    $dfv = Data::FormValidator->new('test/00_base.WRONG');
    my $results = $dfv->check({}, 'profile1'); 
};
like($@, qr/no such file/i, 'bad profile file names should cause death');

eval { 
    $dfv = Data::FormValidator->new('test/00_base.badformat');
    my $results = $dfv->check({}, 'profile1'); 
};
like($@, qr/return a hash ref/, 'profile files should return a hash ref');

eval { $dfv = Data::FormValidator->new('test/00_base.profile'); };

my $results = $dfv->check({}, 'profile1');

ok(scalar $results->missing, 'loading a profile from a file works');