Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / type_constraints / util_type_constraints_export.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 {
9     package Foo;
10
11     use Moose::Util::TypeConstraints;
12
13     eval {
14         type MyRef => where { ref($_) };
15     };
16     ::ok( !$@, '... successfully exported &type to Foo package' );
17
18     eval {
19         subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' };
20     };
21     ::ok( !$@, '... successfully exported &subtype to Foo package' );
22
23     Moose::Util::TypeConstraints->export_type_constraints_as_functions();
24
25     ::ok( MyRef( {} ), '... Ref worked correctly' );
26     ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' );
27 }
28
29 done_testing;