Initial work on Moose.pm exporting
[gitmo/Moose.git] / t / 051_util_type_constraints_export.t
CommitLineData
a15dff8d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 5;
7use Test::Exception;
8
9BEGIN {
a3c7e2fe 10 use_ok('Moose::Util::TypeConstraints', { into => 'Foo' } );
a15dff8d 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}