From: Yuval Kogman Date: Sat, 18 Apr 2009 17:44:59 +0000 (+0200) Subject: rafl's pathological test case X-Git-Tag: 0.12~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=820efec95e5d777aeaeb04a0fcf14d086a76c995;p=gitmo%2FMooseX-Types-Structured.git rafl's pathological test case --- diff --git a/lib/MooseX/Meta/TypeConstraint/Structured.pm b/lib/MooseX/Meta/TypeConstraint/Structured.pm index f199370..e674f8b 100644 --- a/lib/MooseX/Meta/TypeConstraint/Structured.pm +++ b/lib/MooseX/Meta/TypeConstraint/Structured.pm @@ -213,9 +213,7 @@ sub is_a_type_of { my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name); if ( $other->isa(__PACKAGE__) and @{ $other->type_constraints || [] }) { - warn "structured ( $self, $other )"; if ( $self->parent->is_a_type_of($other->parent) ) { - warn "related ( $self, $other )"; return $self->_type_constraints_op_all($other, "is_a_type_of"); } elsif ( $self->parent->is_a_type_of($other) ) { return 1; diff --git a/t/06-api.t b/t/06-api.t index cbfb687..203e2c3 100644 --- a/t/06-api.t +++ b/t/06-api.t @@ -1,7 +1,7 @@ BEGIN { use strict; use warnings; - use Test::More tests=>83; + use Test::More tests=>88; } use Moose::Util::TypeConstraints; @@ -112,6 +112,12 @@ ok (!MyTuple2->is_a_type_of(MyTuple3), 'MyTuple2 NOT is_a_type_of MyTuple3'); ## is_subtype_of +ok ( not((Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]])->equals( Tuple[Tuple[ Item, Item ], Dict[]] )), "tuple of tuple" ); +ok ( (Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]])->equals( Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]] ), "tuple of tuple" ); +ok ( (Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]])->is_a_type_of( Tuple[Tuple[ Item, Item ], Dict[]] ), "tuple of tuple" ); +ok ( (Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]])->is_a_type_of( Tuple[Tuple[ Item, Item ], Dict[]] ), "tuple of tuple" ); +ok ( (Tuple[Tuple[ class_type('Paper'), class_type('Stone') ], Dict[]])->is_subtype_of( Tuple[Tuple[ Item, Item ], Dict[]] ), "tuple of tuple" ); + ok ( MyDict1->is_subtype_of(HashRef), 'MyDict1 is_subtype_of HashRef'); ok ( MyDict1->is_subtype_of(Dict), 'MyDict1 is_subtype_of Dict'); ok ( MyDict1->is_subtype_of(MyDict4), 'MyDict1 is_subtype_of MyDict4');