Commit | Line | Data |
7127b94e |
1 | use strict; |
04c82717 |
2 | use warnings; |
7127b94e |
3 | use Test::More; |
04c82717 |
4 | |
7127b94e |
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; |
04c82717 |
14 | |
15 | has attr => ( |
16 | is => 'ro' |
17 | ); |
18 | |
19 | sub thing {} |
7127b94e |
20 | } |
21 | { |
04c82717 |
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 | { |
7127b94e |
35 | package Bax; |
36 | use Moose; |
37 | with qw/ |
38 | Foo |
39 | Bar |
40 | /; |
41 | } |
42 | |
43 | ok 1; |
44 | done_testing; |
45 | |