10 This tests how well Moose type constraints
13 Its not as pretty as Declare::Constraints::Simple,
14 but it is not completely horrid either.
19 'Test::Deep' => '0.01', # skip all if not installed
27 use Moose::Util::TypeConstraints;
30 eq_deeply array_each subhashof ignore
33 # define your own type ...
34 type 'ArrayOfHashOfBarsAndRandomNumbers'
39 bar => Test::Deep::isa('Bar'),
40 random_number => ignore()
48 isa => 'ArrayOfHashOfBarsAndRandomNumbers',
55 my $array_of_hashes = [
56 { bar => Bar->new, random_number => 10 },
62 $foo = Foo->new('bar' => $array_of_hashes);
63 }, undef, '... construction succeeded' );
66 is_deeply($foo->bar, $array_of_hashes, '... got our value correctly');
70 }, undef, '... validation failed correctly' );
73 $foo->bar([{ foo => 3 }]);
74 }, undef, '... validation failed correctly' );