5 use Test::More tests => 5;
7 # remove this when CheckedUtilExports croaks instead of carps
8 $SIG{__WARN__} = sub { die @_ };
10 my $missing_comma_test = q{
13 use MooseX::Types -declare => ['Foo'];
14 use MooseX::Types::Moose 'Str';
19 message { 'not a Foo' };
24 eval $missing_comma_test;
25 like $@, qr/forget a comma/, 'missing comma error';
27 my $string_as_type_test = q{
30 use MooseX::Types -declare => ['Foo'];
31 use MooseX::Types::Moose 'Str';
33 subtype Foo => # should be ,
36 message { 'not a Foo' };
41 eval $string_as_type_test;
42 like $@, qr/String found where Type expected/, 'string instead of Type error';
44 my $fully_qualified_type = q{
47 use MooseX::Types -declare => ['Foo'];
48 use MooseX::Types::Moose 'Str';
50 subtype TypeLib3::Foo =>
53 message { 'not a Foo' };
58 eval $fully_qualified_type;
59 is $@, '', "fully qualified type doesn't throw error";
64 use MooseX::Types -declare => ['Foo'];
65 use MooseX::Types::Moose 'Str';
71 via { bless \$_, 'mtfnpy' };
76 is $@, '', "declared class_types don't throw error";
81 use MooseX::Types -declare => ['Foo'];
82 use MooseX::Types::Moose 'Str';
88 via { bless \$_, 'mtfnpy' };
93 is $@, '', "declared role_types don't throw error";