Tidy all code
[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
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 => (
33         is      => 'ro', isa => 'Str',
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();