6 use Test::More tests => 12;
11 use_ok('Moose::Util::TypeConstraints');
14 my $type = Moose::Util::TypeConstraints::find_or_create_type_constraint('Maybe[Int]');
15 isa_ok($type, 'Moose::Meta::TypeConstraint');
16 isa_ok($type, 'Moose::Meta::TypeConstraint::Parameterized');
18 ok($type->check(10), '... checked type correctly (pass)');
19 ok($type->check(undef), '... checked type correctly (pass)');
20 ok(!$type->check('Hello World'), '... checked type correctly (fail)');
21 ok(!$type->check([]), '... checked type correctly (fail)');
27 has 'bar' => (is => 'rw', isa => 'Maybe[ArrayRef]', required => 1);
35 Foo->new(bar => undef);
40 } '... failed the type check';
43 Foo->new(bar => 'hello world');
44 } '... failed the type check';