b970a9407e9421731fd71f5a68938b67195bfc32
[gitmo/Moose.git] / t / 051_util_type_constraints_export.t
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         
28         ::ok(MyRef({}), '... Ref worked correctly');
29         ::ok(MyArrayRef([]), '... ArrayRef worked correctly');  
30 }