Regenerate test files
[gitmo/Mouse.git] / t-failing / 040_type_constraints / 033_type_names.t
CommitLineData
b2b106d7 1use strict;
fde8e43f 2# This is automatically generated by author/import-moose-test.pl.
3# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4use t::lib::MooseCompat;
b2b106d7 5use warnings;
6
fde8e43f 7use Test::More;
8$TODO = q{Mouse is not yet completed};
b2b106d7 9use Test::Exception;
10
11use Mouse::Meta::TypeConstraint;
12use Mouse::Util::TypeConstraints;
13
14
15TODO:
16{
17 local $TODO = 'type names are not validated in the TC metaclass';
18
19 throws_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo-Bar' ) }
20 qr/contains invalid characters/,
21 'Type names cannot contain a dash';
22}
23
24lives_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo.Bar::Baz' ) }
25'Type names can contain periods and colons';
26
27throws_ok { subtype 'Foo-Baz' => as 'Item' }
28qr/contains invalid characters/,
29 'Type names cannot contain a dash (via subtype sugar)';
30
31lives_ok { subtype 'Foo.Bar::Baz' => as 'Item' }
32'Type names can contain periods and colons (via subtype sugar)';
33
34is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[In-valid]'),
35 undef,
36 'find_or_parse_type_constraint returns undef on an invalid name' );
37
38is( Mouse::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Va.lid]'),
39 'ArrayRef[Va.lid]',
40 'find_or_parse_type_constraint returns name for valid name' );
fde8e43f 41
42done_testing;