Use done_testing (require Test::More 0.88)
[gitmo/MooseX-Params-Validate.git] / t / 003_nocache_flag.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9 {
10     package Foo;
11     use Moose;
12     use MooseX::Params::Validate;
13
14     sub bar {
15         my ( $self, $args, $params ) = @_;
16         $params->{MX_PARAMS_VALIDATE_NO_CACHE}++;
17         return validated_hash( $args, %$params );
18     }
19 }
20
21 my $foo = Foo->new;
22 isa_ok( $foo, 'Foo' );
23
24 lives_ok {
25     $foo->bar( [ baz => 1 ], { baz => { isa => 'Int' } } );
26 }
27 '... successfully applied the parameter validation';
28
29 lives_ok {
30     $foo->bar( [ baz => [ 1, 2, 3 ] ], { baz => { isa => 'ArrayRef' } } );
31 }
32 '... successfully applied the parameter validation (look mah no cache)';
33
34 lives_ok {
35     $foo->bar( [ baz => { one => 1 } ], { baz => { isa => 'HashRef' } } );
36 }
37 '... successfully applied the parameter validation (look mah no cache) (just checkin)';
38
39 done_testing();