Commit | Line | Data |
14375407 |
1 | use strict; |
2 | use warnings; |
3 | use Test::More; |
4 | |
5 | use Moose::Util::TypeConstraints; |
6 | use MooseX::Types::Structured qw(Dict Tuple); |
7 | use MooseX::Types::Moose qw(Int); |
8 | |
9 | my $deeper_tc = subtype |
10 | as Dict[ |
11 | a => Tuple[ |
12 | Dict[ |
13 | a1a => Tuple[Int], |
14 | a1b => Tuple[Int], |
15 | ], |
16 | Dict[ |
17 | a2a => Tuple[Int], |
18 | a2b => Tuple[Int], |
19 | ], |
20 | ], |
21 | b => Tuple[ |
22 | Dict[ |
23 | b1a => Tuple[Int], |
24 | b1b => Tuple[Int], |
25 | ], |
26 | Dict[ |
27 | b2a => Tuple[Int], |
28 | b2b => Tuple[Int], |
29 | ], |
30 | ], |
31 | ]; |
32 | |
33 | my $struc_to_validate = { |
34 | a=>[ |
35 | { |
36 | a1a=>[1], |
37 | a1b=>[2] |
38 | }, |
39 | { |
0027a103 |
40 | a2a=>['AA'], |
14375407 |
41 | a2b=>[4] |
42 | } |
43 | ], |
44 | b=>[ |
45 | { |
46 | b1a=>[5], |
0027a103 |
47 | b1b=>['BB'] |
14375407 |
48 | }, |
49 | { |
50 | b2a=>[7], |
51 | b2b=>[8] |
52 | } |
53 | ] |
54 | }; |
55 | |
56 | ok my $message = $deeper_tc->validate($struc_to_validate), |
57 | 'got error message of some sort'; |
58 | |
59 | done_testing(); |
60 | |
61 | warn $message; |