And even composing one seems to drag unwanted sugar with it
[gitmo/Moo.git] / xt / moo-roles-into-moose-class.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 {
6     package Foo;
7     use Moo::Role;
8     use namespace::autoclean;
9 }
10 {
11     package Bar;
12     use Moo::Role;
13     use namespace::autoclean;
14
15     has attr => (
16         is => 'ro'
17     );
18
19     sub thing {}
20 }
21 {
22     package Baz;
23     use Moose;
24     no Moose;
25
26     ::ok(!__PACKAGE__->can('has'), 'No has function after no Moose;');
27     Moose::with('Baz', 'Bar');
28 }
29
30 ::is(Baz->can('thing'), Bar->can('thing'), 'Role copies method correctly');
31 ::ok(Baz->can('attr'), 'Attr accessor correct');
32 ::ok(!Baz->can('has'), 'Sugar not copied');
33
34 {
35     package Bax;
36     use Moose;
37     with qw/
38         Foo
39         Bar
40     /;
41 }
42
43 ok 1;
44 done_testing;
45