Commit | Line | Data |
4c252d25 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
a28e50e4 |
6 | use Test::More; |
4c252d25 |
7 | |
8 | use Moose::Util::TypeConstraints; |
9 | |
10 | |
11 | { |
12 | package Foo; |
13 | |
14 | sub new { |
15 | my $class = shift; |
16 | |
17 | return bless {@_}, $class; |
18 | } |
19 | } |
20 | |
21 | subtype 'FooWithSize' |
22 | => as 'Foo' |
23 | => where { $_[0]->{size} }; |
24 | |
25 | |
26 | my $type = find_type_constraint('FooWithSize'); |
27 | ok( $type, 'made a FooWithSize constraint' ); |
28 | ok( $type->parent, 'type has a parent type' ); |
29 | is( $type->parent->name, 'Foo', 'parent type is Foo' ); |
30 | isa_ok( $type->parent, 'Moose::Meta::TypeConstraint::Class', |
31 | 'parent type constraint is a class type' ); |
a28e50e4 |
32 | |
33 | done_testing; |