4 use Test::More tests => 6;
7 use Mouse::Meta::TypeConstraint;
8 use Mouse::Util::TypeConstraints;
13 local $TODO = 'type names are not validated in the TC metaclass';
15 throws_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo-Bar' ) }
16 qr/contains invalid characters/,
17 'Type names cannot contain a dash';
20 lives_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo.Bar::Baz' ) }
21 'Type names can contain periods and colons';
23 throws_ok { subtype 'Foo-Baz' => as 'Item' }
24 qr/contains invalid characters/,
25 'Type names cannot contain a dash (via subtype sugar)';
27 lives_ok { subtype 'Foo.Bar::Baz' => as 'Item' }
28 'Type names can contain periods and colons (via subtype sugar)';
30 is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[In-valid]'),
32 'find_or_parse_type_constraint returns undef on an invalid name' );
34 is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Va.lid]'),
36 'find_or_parse_type_constraint returns name for valid name' );