Codebase list libparams-validate-perl / debian/0.89-2 t / 14-no_validate.t
debian/0.89-2

Tree @debian/0.89-2 (Download .tar.gz)

14-no_validate.t @debian/0.89-2raw · history · blame

#!/usr/bin/perl -w

use strict;

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 } );
}