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;
8 $TODO = q{Mouse is not yet completed};
11 use Mouse::Meta::TypeConstraint;
12 use Mouse::Util::TypeConstraints;
17 local $TODO = 'type names are not validated in the TC metaclass';
19 throws_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo-Bar' ) }
20 qr/contains invalid characters/,
21 'Type names cannot contain a dash';
24 lives_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo.Bar::Baz' ) }
25 'Type names can contain periods and colons';
27 throws_ok { subtype 'Foo-Baz' => as 'Item' }
28 qr/contains invalid characters/,
29 'Type names cannot contain a dash (via subtype sugar)';
31 lives_ok { subtype 'Foo.Bar::Baz' => as 'Item' }
32 'Type names can contain periods and colons (via subtype sugar)';
34 is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[In-valid]'),
36 'find_or_parse_type_constraint returns undef on an invalid name' );
38 is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Va.lid]'),
40 'find_or_parse_type_constraint returns name for valid name' );