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;
BEGIN {
use strict;
use warnings;
- use Test::More tests=>83;
+ use Test::More tests=>88;
}
use Moose::Util::TypeConstraints;
## 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');