Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 040_type_constraints / 031_subtype_auto_vivify_parent.t
CommitLineData
5a592ad7 1#!/usr/bin/perl
2# This is automatically generated by author/import-moose-test.pl.
3# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4use t::lib::MooseCompat;
5
6use strict;
7use warnings;
8
9use Test::More;
10
11use Mouse::Util::TypeConstraints;
12
13
14{
15 package Foo;
16
17 sub new {
18 my $class = shift;
19
20 return bless {@_}, $class;
21 }
22}
23
24subtype 'FooWithSize'
25 => as 'Foo'
26 => where { $_[0]->{size} };
27
28
29my $type = find_type_constraint('FooWithSize');
30ok( $type, 'made a FooWithSize constraint' );
31ok( $type->parent, 'type has a parent type' );
32is( $type->parent->name, 'Foo', 'parent type is Foo' );
33isa_ok( $type->parent, 'Mouse::Meta::TypeConstraint',
34 'parent type constraint is a class type' );
35
36done_testing;