Commit | Line | Data |
a15dff8d |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
a28e50e4 |
6 | use Test::More; |
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 | }; |
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 | Moose::Util::TypeConstraints->export_type_constraints_as_functions(); |
25 | |
26 | ::ok( MyRef( {} ), '... Ref worked correctly' ); |
27 | ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' ); |
28 | } |
a28e50e4 |
29 | |
30 | done_testing; |