Commit | Line | Data |
9924122d |
1 | use strict; |
2 | use warnings; |
3 | |
3272340d |
4 | use Test::More tests => 2; |
5 | |
6 | use Test::Requires { |
7 | 'MooseX::AttributeHelpers' => 0.23, # skip all if not installed |
8 | }; |
9924122d |
9 | |
9924122d |
10 | |
11 | { |
12 | package MyClass; |
13 | |
deaffdd0 |
14 | use Moose; |
9924122d |
15 | use MooseX::ClassAttribute; |
16 | use MooseX::AttributeHelpers; |
17 | |
18 | class_has counter => |
19 | ( metaclass => 'Counter', |
20 | is => 'ro', |
21 | provides => { inc => 'inc_counter', |
22 | }, |
23 | ); |
24 | } |
25 | |
26 | is( MyClass->counter(), 0 ); |
27 | |
28 | MyClass->inc_counter(); |
29 | is( MyClass->counter(), 1 ); |
30 | |