2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
13 This tests how well Mouse type constraints
16 Its not as pretty as Declare::Constraints::Simple,
17 but it is not completely horrid either.
22 'Test::Deep' => '0.01', # skip all if not installed
30 use Mouse::Util::TypeConstraints;
33 eq_deeply array_each subhashof ignore
36 # define your own type ...
37 type 'ArrayOfHashOfBarsAndRandomNumbers'
42 bar => Test::Deep::isa('Bar'),
43 random_number => ignore()
51 isa => 'ArrayOfHashOfBarsAndRandomNumbers',
58 my $array_of_hashes = [
59 { bar => Bar->new, random_number => 10 },
65 $foo = Foo->new('bar' => $array_of_hashes);
66 } '... construction succeeded';
69 is_deeply($foo->bar, $array_of_hashes, '... got our value correctly');
73 } '... validation failed correctly';
76 $foo->bar([{ foo => 3 }]);
77 } '... validation failed correctly';