fixes broken link in pod
[gitmo/Moo.git] / t / accessor-mixed.t
CommitLineData
3a9a65a4 1use strictures 1;
2use Test::More;
3
4my @result;
5
6{
7 package Foo;
8
b1eebd55 9 use Moo;
3a9a65a4 10
11 my @isa = (isa => sub { push @result, 'isa', $_[0] });
12 my @trigger = (trigger => sub { push @result, 'trigger', $_[1] });
13 sub _mkdefault {
14 my $val = shift;
15 (default => sub { push @result, 'default', $val; $val; })
16 }
17
18 has a1 => (
e6f2e914 19 is => 'rw', @isa
3a9a65a4 20 );
21 has a2 => (
e6f2e914 22 is => 'rw', @isa, @trigger
3a9a65a4 23 );
24 has a3 => (
e6f2e914 25 is => 'rw', @isa, @trigger
3a9a65a4 26 );
27 has a4 => (
e6f2e914 28 is => 'rw', @trigger, _mkdefault('a4')
3a9a65a4 29 );
30 has a5 => (
e6f2e914 31 is => 'rw', @trigger, _mkdefault('a5')
3a9a65a4 32 );
33 has a6 => (
e6f2e914 34 is => 'rw', @isa, @trigger, _mkdefault('a6')
3a9a65a4 35 );
36 has a7 => (
e6f2e914 37 is => 'rw', @isa, @trigger, _mkdefault('a7')
3a9a65a4 38 );
39}
40
41my $foo = Foo->new(a1 => 'a1', a2 => 'a2', a4 => 'a4', a6 => 'a6');
42
43is_deeply(
44 \@result,
45 [ qw(isa a1 isa a2 trigger a2 trigger a4 default a5 isa a6 trigger a6
46 default a7 isa a7) ],
47 'Stuff fired in expected order'
48);
49
50done_testing;