use done_testing
[gitmo/MooseX-SemiAffordanceAccessor.git] / t / basic.t
CommitLineData
a338e27f 1use strict;
2use warnings;
3
9ced8063 4use 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 MooseX::SemiAffordanceAccessor;
a338e27f 21 use Moose;
22
f227d76f 23 has 'thing' => ( is => 'rw' );
a338e27f 24 has '_private' => ( is => 'rw' );
25}
26
b95d9f9b 27{
f227d76f 28
b95d9f9b 29 package SAA2;
30
31 # Make sure load order doesn't matter
32 use Moose;
33 use MooseX::SemiAffordanceAccessor;
34
f227d76f 35 has 'thing' => ( is => 'rw' );
b95d9f9b 36 has '_private' => ( is => 'rw' );
37}
38
5f9f886d 39{
f227d76f 40
5f9f886d 41 package SAA3;
42
43 use Moose;
44 use MooseX::SemiAffordanceAccessor;
45
f227d76f 46 has 'ro' => ( is => 'ro' );
47 has 'thing' => ( is => 'rw', reader => 'get_thing' );
5f9f886d 48 has 'thing2' => ( is => 'rw', writer => 'set_it' );
49}
50
08ec520a 51{
f227d76f 52
08ec520a 53 package SAA4;
54
55 use Moose;
56 use MooseX::SemiAffordanceAccessor;
57
58 has bare => ( is => 'bare' );
59}
60
f227d76f 61ok( Standard->can('thing'), 'Standard->thing() exists' );
62ok( !Standard->can('set_thing'), 'Standard->set_thing() does not exist' );
63ok( Standard->can('_private'), 'Standard->_private() exists' );
64ok( !Standard->can('_set_private'),
65 'Standard->_set_private() does not exist' );
a338e27f 66
f227d76f 67ok( SAA->can('thing'), 'SAA->thing() exists' );
68ok( SAA->can('set_thing'), 'SAA->set_thing() exists' );
69ok( SAA->can('_private'), 'SAA->_private() exists' );
b95d9f9b 70ok( SAA->can('_set_private'), 'SAA->_set_private() exists' );
71
f227d76f 72ok( SAA2->can('thing'), 'SAA2->thing() exists' );
73ok( SAA2->can('set_thing'), 'SAA2->set_thing() exists' );
74ok( SAA2->can('_private'), 'SAA2->_private() exists' );
b95d9f9b 75ok( SAA2->can('_set_private'), 'SAA2->_set_private() exists' );
5f9f886d 76
f227d76f 77ok( SAA3->can('ro'), 'SAA3->ro exists' );
78ok( !SAA3->can('set_ro'), 'SAA3->set_ro does not exist' );
79ok( SAA3->can('thing'), 'SAA3->thing exists' );
80ok( !SAA3->can('set_thing'), 'SAA3->set_thing does not exist' );
81ok( SAA3->can('thing2'), 'SAA3->thing2 exists' );
82ok( !SAA3->can('set_thing2'), 'SAA3->set_thing2 does not exist' );
83ok( SAA3->can('set_it'), 'SAA3->set_it does exist' );
08ec520a 84
f227d76f 85ok( !SAA4->can('bare'), 'SAA4->bare does not exist' );
86ok( !SAA4->can('set_bare'), 'SAA4->set_bare does not exist' );
9ced8063 87
88done_testing();