Commit | Line | Data |
68a51c00 |
1 | use strictures 1; |
2 | use Test::More; |
3 | |
4 | my @result; |
5 | |
6 | { |
7 | package Foo; |
8 | |
9 | use Moo; |
10 | |
11 | has one => ( |
12 | is => 'rw', |
13 | reader => 'get_one', |
14 | writer => 'set_one', |
15 | ); |
16 | } |
17 | |
18 | { |
19 | package Bar; |
20 | |
21 | use Moo; |
22 | |
23 | has two => ( |
24 | is => 'rw', |
25 | accessor => 'TWO', |
26 | ); |
27 | } |
28 | |
29 | my $foo = Foo->new(one => 'lol'); |
30 | my $bar = Bar->new(two => '...'); |
31 | |
32 | is( $foo->get_one, 'lol', 'reader works' ); |
33 | $foo->set_one('rofl'); |
34 | is( $foo->get_one, 'rofl', 'writer works' ); |
35 | |
36 | is( $bar->TWO, '...', 'accessor works for reading' ); |
37 | $bar->TWO('!!!'); |
38 | is( $bar->TWO, '!!!', 'accessor works for writing' ); |
39 | |
40 | done_testing; |