blob: bbd0640fdb8d1a8f65d6b51ce2643ff2f7501ab5 (
plain)
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
|
use strict;
use warnings;
use Params::Validate qw( validate SCALAR SCALARREF );
use Test::More;
use Test::Fatal;
is(
exception { v( foo => qr/foo/ ) },
undef,
'no exception with regex object'
);
is(
exception { v( foo => 'foo' ) },
undef,
'no exception with plain scalar'
);
my $foo = 'foo';
is(
exception { v( foo => \$foo ) },
undef,
'no exception with scalar ref'
);
done_testing();
sub v {
validate(
@_, {
foo => { type => SCALAR | SCALARREF },
},
);
return;
}
|