Add assert_valid() to Meta::TypeConstraint
[gitmo/Mouse.git] / t / 040_type_constraints / failing / 002_util_type_constraints_export.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 4;
7 use Test::Exception;
8
9 {
10     package Foo;
11
12     use Mouse::Util::TypeConstraints;
13
14     eval {
15         type MyRef => where { ref($_) };
16     };
17     ::ok( !$@, '... successfully exported &type to Foo package' );
18
19     eval {
20         subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' };
21     };
22     ::ok( !$@, '... successfully exported &subtype to Foo package' );
23
24     Mouse::Util::TypeConstraints->export_type_constraints_as_functions();
25
26     ::ok( MyRef( {} ), '... Ref worked correctly' );
27     ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' );
28 }