10 This tests how well Mouse type constraints
13 Its not as pretty as Declare::Constraints::Simple,
14 but it is not completely horrid either.
19 eval "use Test::Deep;";
20 plan skip_all => "Test::Deep is required for this test" if $@;
29 use Mouse::Util::TypeConstraints;
32 eq_deeply array_each subhashof ignore
35 # define your own type ...
36 type 'ArrayOfHashOfBarsAndRandomNumbers'
41 bar => Test::Deep::isa('Bar'),
42 random_number => ignore()
50 isa => 'ArrayOfHashOfBarsAndRandomNumbers',
57 my $array_of_hashes = [
58 { bar => Bar->new, random_number => 10 },
64 $foo = Foo->new('bar' => $array_of_hashes);
65 } '... construction succeeded';
68 is_deeply($foo->bar, $array_of_hashes, '... got our value correctly');
72 } '... validation failed correctly';
75 $foo->bar([{ foo => 3 }]);
76 } '... validation failed correctly';