6 use Test::More tests => 12;
19 use Moose::Util::TypeConstraints;
24 isa => subtype('ArrayRef' => where {
25 (blessed($_) && $_->isa('Customer') || return) for @$_; 1 }),
28 } '... successfully created attr';
32 my $customer = Customer->new;
33 isa_ok($customer, 'Customer');
35 my $firm = Firm->new(customers => [ $customer ]);
36 isa_ok($firm, 'Firm');
38 can_ok($firm, 'customers');
43 '... got the right dereferenced value'
48 my $firm = Firm->new();
49 isa_ok($firm, 'Firm');
51 can_ok($firm, 'customers');
56 '... got the right dereferenced value'
66 isa => 'ArrayRef[Int]',
72 my $autoderef = AutoDeref->new;
75 $autoderef->bar(1, 2, 3);
76 } '... its auto-de-ref-ing, not auto-en-ref-ing';
79 $autoderef->bar([ 1, 2, 3 ])
80 } '... set the results of bar correctly';
82 is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';