07b2f1698625eed2863754e273cd92e191c0641b
[gitmo/MooseX-ClassAttribute.git] / t / 11-moose-exporter.t
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(
18         also => [ 'MooseX::ClassAttribute' ],
19     );
20 }
21
22 {
23     package MyClass;
24
25     use Moose;
26     # use MooseX::Foo;  # normal use
27     MooseX::Foo->import;
28
29     # Now theoretically, this should work -- the 'class_has' method
30     # should have been imported via the MooseX package above.
31     class_has attr => (
32         is => 'ro', isa => 'Str',
33         default => 'foo',
34     );
35 }
36
37 my $obj = MyClass->new();
38
39 is( $obj->attr(), 'foo', 'class attribute is properly created' );
40
41 done_testing();