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
|
#!/usr/bin/perl -w
# This tests to make sure that when we test $@, we are testing the right thing.
# inspired by a patch from dom@semantico.com
use lib ('.','../t');
$^W = 1;
use Test::More tests => 1;
use strict;
use Data::FormValidator;
# So as to not trigger a require later on in the code.
require UNIVERSAL;
my $input_profile =
{
required => 'nothing',
};
my $validator = new Data::FormValidator({default => $input_profile});
my $input_hashref = {
'1_required' => 1,
'1_optional' => 1,
};
eval {
# populate $@ to see if D::FV dies when it shouldn't
$@ = 'exceptional value';
my ($valids, $missings, $invalids, $unknowns) = ({},[],[],[]);
($valids, $missings, $invalids, $unknowns) = $validator->validate($input_hashref, 'default');
};
unlike($@, qr/Error compiling regular expression/);
# vim: set ai et sw=8 syntax=perl :
|