Make prereq requirements explicit in code
[gitmo/MooseX-ClassAttribute.git] / t / 11-moose-exporter.t
CommitLineData
e3e09e66 1use strict;
2use warnings;
3
4use Test::More;
5
6BEGIN { 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
37my $obj = MyClass->new();
38
39is( $obj->attr(), 'foo', 'class attribute is properly created' );
40
41done_testing();