summaryrefslogtreecommitdiff
path: root/t/release-pp-27-string-as-type.t
blob: bb19f378ba94f0d18c10184ef10eade8009ea37d (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
38
39
40
41
42
43


use Test::More;

BEGIN {
    unless ( $ENV{RELEASE_TESTING} ) {
        plan skip_all => 'these tests are for release testing';
    }

    $ENV{PV_TEST_PERL} = 1;
}

use strict;
use warnings;

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

{
    my @p = ( foo => 1 );

    eval { validate( @p, { foo => { type => 'SCALAR' } }, ); };

    like(
        $@,
        qr/\QThe 'foo' parameter ("1") has a type specification which is not a number. It is a string - SCALAR/
    );
}

{
    my @p = ( foo => 1 );

    eval { validate( @p, { foo => { type => undef } }, ); };

    like(
        $@,
        qr/\QThe 'foo' parameter ("1") has a type specification which is not a number. It is undef/
    );

}

done_testing();