Moose now warns when you try to load it from the main package. Added a
[gitmo/Moose.git] / t / 030_roles / 030_role_parameterized.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More skip_all => 'The feature this test exercises is not yet written';
7 use Test::Exception;
8
9
10 {
11     package Scalar;
12     use Moose::Role; 
13     
14     BEGIN { parameter T => { isa => 'Moose::Meta::TypeConstraint' } };
15
16     has 'val' => (is => 'ro', isa => T);
17     
18     requires 'eq';
19     
20     sub not_eq { ! (shift)->eq(shift) }
21 }
22
23 is_deeply(
24     Scalar->meta->parameters,
25     { T => { isa => 'Moose::Meta::TypeConstraint' } },
26     '... got the right parameters in the role'
27 );
28
29 {
30     package Integers;
31     use Moose;
32     use Moose::Util::TypeConstraints;
33
34     with Scalar => { T => find_type_constraint('Int') };
35     
36     sub eq { shift == shift }
37 }