File: 25-undef-regex.t

package info (click to toggle)
libparams-validate-perl 1.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,360 kB
  • sloc: perl: 2,374; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 319 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use strict;
use warnings;

use Params::Validate qw(validate);
use Test::More;

{
    my @w;
    local $SIG{__WARN__} = sub { push @w, @_ };

    my @p = ( foo => undef );
    eval { validate( @p, { foo => { regex => qr/^bar/ } } ) };
    ok( $@,  'validation failed' );
    ok( !@w, 'no warnings' );
}

done_testing();