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;
10 $TODO = q{Mouse is not yet completed};
13 use_ok("Mouse::Util::TypeConstraints");
18 This is a good candidate for LectroTest
23 ## check the containers
25 ok(Mouse::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
26 '... this correctly detected a container (' . $_ . ')')
29 'ArrayRef[Foo | Int]',
30 'ArrayRef[ArrayRef[Int]]',
31 'ArrayRef[ArrayRef[Int | Foo]]',
32 'ArrayRef[ArrayRef[Int|Str]]',
35 ok(!Mouse::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
36 '... this correctly detected a non-container (' . $_ . ')')
44 'ArrayRef[Foo]' => [ 'ArrayRef', 'Foo' ],
45 'ArrayRef[Foo | Int]' => [ 'ArrayRef', 'Foo | Int' ],
46 'ArrayRef[Foo|Int]' => [ 'ArrayRef', 'Foo|Int' ],
47 # these will get processed with recusion,
48 # so we only need to detect it once
49 'ArrayRef[ArrayRef[Int]]' => [ 'ArrayRef', 'ArrayRef[Int]' ],
50 'ArrayRef[ArrayRef[Int | Foo]]' => [ 'ArrayRef', 'ArrayRef[Int | Foo]' ],
51 'ArrayRef[ArrayRef[Int|Str]]' => [ 'ArrayRef', 'ArrayRef[Int|Str]' ],
55 [ Mouse::Util::TypeConstraints::_parse_parameterized_type_constraint($_) ],
57 '... this correctly split the container (' . $_ . ')'
58 ) for keys %split_tests;
63 ok(Mouse::Util::TypeConstraints::_detect_type_constraint_union($_),
64 '... this correctly detected union (' . $_ . ')')
68 'ArrayRef[Foo] | Int',
70 'Int | ArrayRef[Foo]',
72 'ArrayRef[Foo | Int] | Str',
73 'ArrayRef[Foo|Int]|Str',
74 'Str | ArrayRef[Foo | Int]',
75 'Str|ArrayRef[Foo|Int]',
76 'Some|Silly|Name|With|Pipes | Int',
77 'Some|Silly|Name|With|Pipes|Int',
80 ok(!Mouse::Util::TypeConstraints::_detect_type_constraint_union($_),
81 '... this correctly detected a non-union (' . $_ . ')')
84 'ArrayRef[Foo | Int]',
90 'Int | Str' => [ 'Int', 'Str' ],
91 'Int|Str' => [ 'Int', 'Str' ],
92 'ArrayRef[Foo] | Int' => [ 'ArrayRef[Foo]', 'Int' ],
93 'ArrayRef[Foo]|Int' => [ 'ArrayRef[Foo]', 'Int' ],
94 'Int | ArrayRef[Foo]' => [ 'Int', 'ArrayRef[Foo]' ],
95 'Int|ArrayRef[Foo]' => [ 'Int', 'ArrayRef[Foo]' ],
96 'ArrayRef[Foo | Int] | Str' => [ 'ArrayRef[Foo | Int]', 'Str' ],
97 'ArrayRef[Foo|Int]|Str' => [ 'ArrayRef[Foo|Int]', 'Str' ],
98 'Str | ArrayRef[Foo | Int]' => [ 'Str', 'ArrayRef[Foo | Int]' ],
99 'Str|ArrayRef[Foo|Int]' => [ 'Str', 'ArrayRef[Foo|Int]' ],
100 'Some|Silly|Name|With|Pipes | Int' => [ 'Some', 'Silly', 'Name', 'With', 'Pipes', 'Int' ],
101 'Some|Silly|Name|With|Pipes|Int' => [ 'Some', 'Silly', 'Name', 'With', 'Pipes', 'Int' ],
105 [ Mouse::Util::TypeConstraints::_parse_type_constraint_union($_) ],
107 '... this correctly split the union (' . $_ . ')'
108 ) for keys %split_tests;