File: 14-no_validate.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 (28 lines) | stat: -rw-r--r-- 405 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
use strict;
use warnings;

use lib './t';

use Params::Validate qw(validate);

use Test::More;
plan tests => $] == 5.006 ? 2 : 3;

eval { foo() };
like( $@, qr/parameter 'foo'/ );

{
    local $Params::Validate::NO_VALIDATION = 1;

    eval { foo() };
    is( $@, q{} );
}

unless ( $] == 5.006 ) {
    eval { foo() };
    like( $@, qr/parameter 'foo'/ );
}

sub foo {
    validate( @_, { foo => 1 } );
}