1#!/usr/bin/perl -w
2
3use strict;
4
5use Params::Validate qw(validate validate_pos SCALAR);
6use Test::More;
7
8BEGIN
9{
10    eval "use Readonly";
11    if ( $@ || ! defined $Readonly::XS::VERSION )
12    {
13        plan skip_all => 'Need Readonly::XS and Readonly for this test';
14    }
15    else
16    {
17        plan tests => 2;
18    }
19}
20
21{
22    Readonly my $spec => { foo => 1 };
23    my @p = ( foo => 'hello' );
24
25    eval { validate( @p, $spec ) };
26    is( $@, q{}, 'validate() call succeeded with Readonly spec hashref' );
27}
28
29{
30    Readonly my $spec => { type => SCALAR };
31    my @p = 'hello';
32
33    eval { validate_pos( @p, $spec ) };
34    is( $@, q{}, 'validate_pos() call succeeded with Readonly spec hashref' );
35}
36
37