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