Add assert_valid() to Meta::TypeConstraint
[gitmo/Mouse.git] / t / 040_type_constraints / failing / 031_subtype_auto_vivify_parent.t
CommitLineData
b2b106d7 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 4;
7
8use Mouse::Util::TypeConstraints;
9
10
11{
12 package Foo;
13
14 sub new {
15 my $class = shift;
16
17 return bless {@_}, $class;
18 }
19}
20
21subtype 'FooWithSize'
22 => as 'Foo'
23 => where { $_[0]->{size} };
24
25
26my $type = find_type_constraint('FooWithSize');
27ok( $type, 'made a FooWithSize constraint' );
28ok( $type->parent, 'type has a parent type' );
29is( $type->parent->name, 'Foo', 'parent type is Foo' );
30isa_ok( $type->parent, 'Mouse::Meta::TypeConstraint::Class',
31 'parent type constraint is a class type' );