Commit | Line | Data |
e3e09e66 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | |
6 | BEGIN { plan skip_all => 'This test fails with a syntax error' } |
7 | |
8 | { |
9 | package MooseX::Foo; |
10 | |
11 | use strict; |
12 | use warnings; |
13 | |
14 | use Moose::Exporter; |
15 | use MooseX::ClassAttribute (); |
16 | |
17 | Moose::Exporter->setup_import_methods( |
3e9e5aef |
18 | also => ['MooseX::ClassAttribute'], |
e3e09e66 |
19 | ); |
20 | } |
21 | |
22 | { |
23 | package MyClass; |
24 | |
25 | use Moose; |
3e9e5aef |
26 | |
e3e09e66 |
27 | # use MooseX::Foo; # normal use |
28 | MooseX::Foo->import; |
29 | |
30 | # Now theoretically, this should work -- the 'class_has' method |
31 | # should have been imported via the MooseX package above. |
32 | class_has attr => ( |
3e9e5aef |
33 | is => 'ro', isa => 'Str', |
e3e09e66 |
34 | default => 'foo', |
35 | ); |
36 | } |
37 | |
38 | my $obj = MyClass->new(); |
39 | |
40 | is( $obj->attr(), 'foo', 'class attribute is properly created' ); |
41 | |
42 | done_testing(); |