5 ## Bug report was that if calling ->is_subtype on crap (not a type, etc) you
6 ## get a not very helpful error message. Fix was to make crap just return
7 ## boolean false to make this like the rest of Moose type constraints. I am
8 ## not convinced this is good, but at least is consistent.
10 # I also changed ->equals and ->is_a_type_of to be consistent
13 package moosex::types::structured::bug_is_subtype;
16 use MooseX::Types -declare => [qw/ ThingType /];
17 use MooseX::Types::Moose qw/ Int Str /;
18 use MooseX::Types::Structured qw/ Dict /;
20 subtype ThingType, as Dict [ id => Int, name => Str, ];
21 has thing => ( is => 'ro', isa => ThingType, );
24 ok my $test = moosex::types::structured::bug_is_subtype->new,
28 moosex::types::structured::bug_is_subtype::ThingType,
29 'moosex::types::structured::bug_is_subtype::ThingType',
33 use MooseX::Types::Moose 'HashRef';
42 moosex::types::structured::bug_is_subtype::ThingType->is_subtype_of(HashRef),
47 !moosex::types::structured::bug_is_subtype::ThingType
48 ->is_subtype_of(moosex::types::structured::bug_is_subtype::ThingType),
53 !moosex::types::structured::bug_is_subtype::ThingType
54 ->is_subtype_of('SomeCrap'),
61 !moosex::types::structured::bug_is_subtype::ThingType
62 ->is_subtype_of(SomeCrap),
67 !moosex::types::structured::bug_is_subtype::ThingType
68 ->is_subtype_of(undef),
73 !moosex::types::structured::bug_is_subtype::ThingType
79 !moosex::types::structured::bug_is_subtype::ThingType
80 ->is_a_type_of(undef),