Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / native_traits / array_from_role.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Fatal;
8
9 {
10     package Foo;
11     use Moose;
12
13     has 'bar' => ( is => 'rw' );
14
15     package Stuffed::Role;
16     use Moose::Role;
17
18     has 'options' => (
19         traits => ['Array'],
20         is     => 'ro',
21         isa    => 'ArrayRef[Foo]',
22     );
23
24     package Bulkie::Role;
25     use Moose::Role;
26
27     has 'stuff' => (
28         traits  => ['Array'],
29         is      => 'ro',
30         isa     => 'ArrayRef',
31         handles => {
32             get_stuff => 'get',
33         }
34     );
35
36     package Stuff;
37     use Moose;
38
39     ::is( ::exception { with 'Stuffed::Role';
40         }, undef, '... this should work correctly' );
41
42     ::is( ::exception { with 'Bulkie::Role';
43         }, undef, '... this should work correctly' );
44 }
45
46 done_testing;