Renamed to MooseX::SemiAffordanceAccessor, because we no longer need
[gitmo/MooseX-SemiAffordanceAccessor.git] / t / basic.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 12;
5
6
7 {
8     package Standard;
9
10     use Moose;
11
12     has 'thing' => ( is => 'rw' );
13     has '_private' => ( is => 'rw' );
14 }
15
16 {
17     package SAA;
18
19     use MooseX::SemiAffordanceAccessor;
20     use Moose;
21
22     has 'thing' => ( is => 'rw' );
23     has '_private' => ( is => 'rw' );
24 }
25
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
37
38 ok( Standard->can('thing'), 'Standard->thing() exists' );
39 ok( ! Standard->can('set_thing'), 'Standard->set_thing() does not exist' );
40 ok( Standard->can('_private'), 'Standard->_private() exists' );
41 ok( ! Standard->can('_set_private'), 'Standard->_set_private() does not exist' );
42
43 ok( SAA->can('thing'), 'SAA->thing() exists' );
44 ok( SAA->can('set_thing'), 'SAA->set_thing() exists' );
45 ok( SAA->can('_private'), 'SAA->_private() exists' );
46 ok( SAA->can('_set_private'), 'SAA->_set_private() exists' );
47
48 ok( SAA2->can('thing'), 'SAA2->thing() exists' );
49 ok( SAA2->can('set_thing'), 'SAA2->set_thing() exists' );
50 ok( SAA2->can('_private'), 'SAA2->_private() exists' );
51 ok( SAA2->can('_set_private'), 'SAA2->_set_private() exists' );