File: 14-no_validate.t

package info (click to toggle)
libparams-validate-perl 0.76-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 316 kB
  • ctags: 214
  • sloc: perl: 2,230; makefile: 36
file content (31 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -w

use strict;

use lib './t';

use Params::Validate qw(validate);

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

eval { foo() };
ok( $@ =~ /parameter 'foo'/ );

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

    eval { foo() };
    ok( ! $@ );
}

unless ( $] == 5.006 )
{
    eval { foo() };
    ok( $@ =~ /parameter 'foo'/ );
}

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