Commit | Line | Data |
c3398f5b |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 10; |
5 | |
6 | do { |
7 | package Class; |
8 | use Mouse; |
9 | |
10 | has 'x'; |
11 | |
12 | has 'y' => ( |
13 | is => 'ro', |
14 | ); |
15 | |
16 | has 'z' => ( |
17 | is => 'rw', |
18 | ); |
19 | }; |
20 | |
21 | ok(!Class->can('x'), "No accessor is injected if 'is' has no value"); |
22 | can_ok('Class', 'y', 'z'); |
23 | |
24 | my $object = Class->new; |
25 | |
26 | ok(!$object->can('x'), "No accessor is injected if 'is' has no value"); |
27 | can_ok($object, 'y', 'z'); |
28 | |
29 | is($object->y, undef); |
30 | is($object->y(10), undef); |
31 | is($object->y, undef); |
32 | |
33 | is($object->z, undef); |
34 | is($object->z(10), 10); |
35 | is($object->z, 10); |
36 | |