Commit | Line | Data |
a15dff8d |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
3860f446 |
6 | use Test::More tests => 4; |
a15dff8d |
7 | use Test::Exception; |
8 | |
a15dff8d |
9 | { |
10 | package Foo; |
11 | |
3860f446 |
12 | use Moose::Util::TypeConstraints; |
13 | |
1a2cafee |
14 | eval { |
15 | type MyRef => where { ref($_) }; |
16 | }; |
1808c2da |
17 | ::ok( !$@, 'successfully exported &type to Foo package' ); |
1a2cafee |
18 | |
19 | eval { |
20 | subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' }; |
21 | }; |
1808c2da |
22 | ::ok( !$@, 'successfully exported &subtype to Foo package' ); |
1a2cafee |
23 | |
24 | Moose::Util::TypeConstraints->export_type_constraints_as_functions(); |
25 | |
1808c2da |
26 | ::ok( MyRef( {} ), 'Ref worked correctly' ); |
27 | ::ok( MyArrayRef( [] ), 'ArrayRef worked correctly' ); |
1a2cafee |
28 | } |