1use strict;
2use warnings;
3
4use Test::More "$]" < 5.008009
5  ? (skip_all => 'Mouse is broken on perl <= 5.8.8')
6  : ();
7use Test::Fatal;
8
9BEGIN {
10  package Ker;
11
12  use Moo::Role;
13
14  sub has_ker {}
15}
16
17BEGIN {
18  package Splat2;
19
20  use Mouse::Role;
21
22  requires 'monkey';
23
24  sub punch { 1 }
25
26  sub jab { 0 }
27
28  around monkey => sub { 'OW' };
29
30  has trap => (is => 'ro', default => sub { -1 });
31
32  sub has_splat {}
33}
34
35BEGIN {
36  package KerSplat2;
37  use Moo::Role;
38
39  with qw(Ker Splat2);
40}
41
42BEGIN {
43  package KerSplattered2;
44
45  use Moo;
46
47  sub monkey { 'WHAT' }
48
49  with qw(KerSplat2);
50
51  sub jab { 3 }
52}
53
54BEGIN {
55  package Splattered2;
56
57  use Moo;
58
59  sub monkey { 'WHAT' }
60
61  with qw(Splat2);
62
63  sub jab { 3 }
64}
65
66BEGIN {
67  package Ker::Splattered2;
68
69  use Moo;
70
71  sub monkey { 'WHAT' }
72
73  with qw(Ker Splat2);
74
75  sub jab { 3 }
76}
77
78foreach my $s (
79    Splattered2->new,
80    Ker::Splattered2->new,
81    KerSplattered2->new,
82) {
83  can_ok($s, 'punch')
84    and is($s->punch, 1, 'punch');
85  can_ok($s, 'jab')
86    and is($s->jab, 3, 'jab');
87  can_ok($s, 'monkey')
88    and is($s->monkey, 'OW', 'monkey');
89  can_ok($s, 'trap')
90    and is($s->trap, -1, 'trap');
91}
92
93foreach my $c (qw/
94    Ker::Splattered2
95    KerSplattered2
96/) {
97  can_ok($c, 'has_ker');
98  can_ok($c, 'has_splat');
99}
100
101is ref Splattered2->meta, 'Moo::HandleMoose::FakeMetaClass',
102  'Mouse::Role meta method not copied';
103
104done_testing;
105