Regenerate test files
[gitmo/Mouse.git] / t-failing / 040_type_constraints / 033_type_names.t
1 use strict;
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;
5 use warnings;
6
7 use Test::More;
8 $TODO = q{Mouse is not yet completed};
9 use Test::Exception;
10
11 use Mouse::Meta::TypeConstraint;
12 use Mouse::Util::TypeConstraints;
13
14
15 TODO:
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
24 lives_ok { Mouse::Meta::TypeConstraint->new( name => 'Foo.Bar::Baz' ) }
25 'Type names can contain periods and colons';
26
27 throws_ok { subtype 'Foo-Baz' => as 'Item' }
28 qr/contains invalid characters/,
29     'Type names cannot contain a dash (via subtype sugar)';
30
31 lives_ok { subtype 'Foo.Bar::Baz' => as 'Item' }
32 'Type names can contain periods and colons (via subtype sugar)';
33
34 is( 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
38 is( 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' );
41
42 done_testing;