6 use Test::More tests => 11;
17 use Moose::Util::TypeConstraints;
22 isa => subtype('ArrayRef' => where {
23 (blessed($_) && $_->isa('Customer') || return) for @$_; 1 }),
26 } '... successfully created attr';
30 my $customer = Customer->new;
31 isa_ok($customer, 'Customer');
33 my $firm = Firm->new(customers => [ $customer ]);
34 isa_ok($firm, 'Firm');
36 can_ok($firm, 'customers');
41 '... got the right dereferenced value'
46 my $firm = Firm->new();
47 isa_ok($firm, 'Firm');
49 can_ok($firm, 'customers');
54 '... got the right dereferenced value'
64 isa => 'ArrayRef[Int]',
70 my $autoderef = AutoDeref->new;
73 $autoderef->bar(1, 2, 3);
74 } '... its auto-de-ref-ing, not auto-en-ref-ing';
77 $autoderef->bar([ 1, 2, 3 ])
78 } '... set the results of bar correctly';
80 is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';