Commit | Line | Data |
a338e27f |
1 | use strict; |
2 | use warnings; |
3 | |
9ced8063 |
4 | use Test::More; |
a338e27f |
5 | |
a338e27f |
6 | { |
f227d76f |
7 | |
a338e27f |
8 | package Standard; |
9 | |
10 | use Moose; |
11 | |
f227d76f |
12 | has 'thing' => ( is => 'rw' ); |
a338e27f |
13 | has '_private' => ( is => 'rw' ); |
14 | } |
15 | |
16 | { |
f227d76f |
17 | |
b95d9f9b |
18 | package SAA; |
a338e27f |
19 | |
b95d9f9b |
20 | use Moose; |
21 | use MooseX::SemiAffordanceAccessor; |
22 | |
f227d76f |
23 | has 'thing' => ( is => 'rw' ); |
b95d9f9b |
24 | has '_private' => ( is => 'rw' ); |
25 | } |
26 | |
5f9f886d |
27 | { |
f227d76f |
28 | |
5f9f886d |
29 | package SAA3; |
30 | |
31 | use Moose; |
32 | use MooseX::SemiAffordanceAccessor; |
33 | |
f227d76f |
34 | has 'ro' => ( is => 'ro' ); |
35 | has 'thing' => ( is => 'rw', reader => 'get_thing' ); |
5f9f886d |
36 | has 'thing2' => ( is => 'rw', writer => 'set_it' ); |
37 | } |
38 | |
08ec520a |
39 | { |
f227d76f |
40 | |
08ec520a |
41 | package SAA4; |
42 | |
43 | use Moose; |
44 | use MooseX::SemiAffordanceAccessor; |
45 | |
46 | has bare => ( is => 'bare' ); |
47 | } |
48 | |
f227d76f |
49 | ok( Standard->can('thing'), 'Standard->thing() exists' ); |
50 | ok( !Standard->can('set_thing'), 'Standard->set_thing() does not exist' ); |
51 | ok( Standard->can('_private'), 'Standard->_private() exists' ); |
52 | ok( !Standard->can('_set_private'), |
53 | 'Standard->_set_private() does not exist' ); |
a338e27f |
54 | |
f227d76f |
55 | ok( SAA->can('thing'), 'SAA->thing() exists' ); |
56 | ok( SAA->can('set_thing'), 'SAA->set_thing() exists' ); |
57 | ok( SAA->can('_private'), 'SAA->_private() exists' ); |
b95d9f9b |
58 | ok( SAA->can('_set_private'), 'SAA->_set_private() exists' ); |
59 | |
f227d76f |
60 | ok( SAA3->can('ro'), 'SAA3->ro exists' ); |
61 | ok( !SAA3->can('set_ro'), 'SAA3->set_ro does not exist' ); |
62 | ok( SAA3->can('thing'), 'SAA3->thing exists' ); |
63 | ok( !SAA3->can('set_thing'), 'SAA3->set_thing does not exist' ); |
64 | ok( SAA3->can('thing2'), 'SAA3->thing2 exists' ); |
65 | ok( !SAA3->can('set_thing2'), 'SAA3->set_thing2 does not exist' ); |
66 | ok( SAA3->can('set_it'), 'SAA3->set_it does exist' ); |
08ec520a |
67 | |
f227d76f |
68 | ok( !SAA4->can('bare'), 'SAA4->bare does not exist' ); |
69 | ok( !SAA4->can('set_bare'), 'SAA4->set_bare does not exist' ); |
9ced8063 |
70 | |
71 | done_testing(); |