we aren't coring Bag
[gitmo/Moose.git] / t / 070_attribute_helpers / 010_array_from_role.t
CommitLineData
e3c07b19 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a5209c26 6use Test::More tests => 2;
e3c07b19 7use Test::Exception;
8
e3c07b19 9{
10 package Foo;
11 use Moose;
12
d50fc84a 13 has 'bar' => ( is => 'rw' );
e3c07b19 14
15 package Stuffed::Role;
16 use Moose::Role;
a5209c26 17 use Moose::AttributeHelpers;
e3c07b19 18
19 has 'options' => (
d50fc84a 20 traits => ['Collection::Array'],
21 is => 'ro',
22 isa => 'ArrayRef[Foo]',
e3c07b19 23 );
24
25 package Bulkie::Role;
26 use Moose::Role;
a5209c26 27 use Moose::AttributeHelpers;
e3c07b19 28
29 has 'stuff' => (
d50fc84a 30 traits => ['Collection::Array'],
31 is => 'ro',
32 isa => 'ArrayRef',
33 handles => {
c13596ce 34 get_stuff => 'get',
e3c07b19 35 }
36 );
37
38 package Stuff;
39 use Moose;
40
d50fc84a 41 ::lives_ok{ with 'Stuffed::Role';
42 } '... this should work correctly';
e3c07b19 43
d50fc84a 44 ::lives_ok{ with 'Bulkie::Role';
45 } '... this should work correctly';
e3c07b19 46}