Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 040_type_constraints / 031_subtype_auto_vivify_parent.t
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!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10
11 use 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
24 subtype 'FooWithSize'
25     => as 'Foo'
26     => where { $_[0]->{size} };
27
28
29 my $type = find_type_constraint('FooWithSize');
30 ok( $type,         'made a FooWithSize constraint' );
31 ok( $type->parent, 'type has a parent type' );
32 is( $type->parent->name, 'Foo', 'parent type is Foo' );
33 isa_ok( $type->parent, 'Mouse::Meta::TypeConstraint',
34         'parent type constraint is a class type' );
35
36 done_testing;