Renamed to MooseX::SemiAffordanceAccessor, because we no longer need
[gitmo/MooseX-SemiAffordanceAccessor.git] / t / basic.t
CommitLineData
a338e27f 1use strict;
2use warnings;
3
b95d9f9b 4use Test::More tests => 12;
a338e27f 5
6
7{
8 package Standard;
9
10 use Moose;
11
12 has 'thing' => ( is => 'rw' );
13 has '_private' => ( is => 'rw' );
14}
15
16{
b95d9f9b 17 package SAA;
a338e27f 18
b95d9f9b 19 use MooseX::SemiAffordanceAccessor;
a338e27f 20 use Moose;
21
22 has 'thing' => ( is => 'rw' );
23 has '_private' => ( is => 'rw' );
24}
25
b95d9f9b 26{
27 package SAA2;
28
29 # Make sure load order doesn't matter
30 use Moose;
31 use MooseX::SemiAffordanceAccessor;
32
33 has 'thing' => ( is => 'rw' );
34 has '_private' => ( is => 'rw' );
35}
36
a338e27f 37
38ok( Standard->can('thing'), 'Standard->thing() exists' );
39ok( ! Standard->can('set_thing'), 'Standard->set_thing() does not exist' );
40ok( Standard->can('_private'), 'Standard->_private() exists' );
41ok( ! Standard->can('_set_private'), 'Standard->_set_private() does not exist' );
42
b95d9f9b 43ok( SAA->can('thing'), 'SAA->thing() exists' );
44ok( SAA->can('set_thing'), 'SAA->set_thing() exists' );
45ok( SAA->can('_private'), 'SAA->_private() exists' );
46ok( SAA->can('_set_private'), 'SAA->_set_private() exists' );
47
48ok( SAA2->can('thing'), 'SAA2->thing() exists' );
49ok( SAA2->can('set_thing'), 'SAA2->set_thing() exists' );
50ok( SAA2->can('_private'), 'SAA2->_private() exists' );
51ok( SAA2->can('_set_private'), 'SAA2->_set_private() exists' );