calculate mro module once
[gitmo/Role-Tiny.git] / t / role-with-inheritance.t
1 use strict;
2 use warnings FATAL => 'all';
3 use Test::More;
4
5 {
6   package R1;
7   use Role::Tiny;
8 }
9 {
10   package R2;
11   use Role::Tiny;
12 }
13 {
14   package C1;
15   use Role::Tiny::With;
16   with 'R1';
17 }
18 {
19   package C2;
20   use Role::Tiny::With;
21   our @ISA=('C1');
22   with 'R2';
23 }
24
25 ok Role::Tiny::does_role('C1','R1'), "Parent does own role";
26 ok !Role::Tiny::does_role('C1','R2'), "Parent does not do child's role";
27 ok Role::Tiny::does_role('C2','R1'), "Child does base's role";
28 ok Role::Tiny::does_role('C2','R2'), "Child does own role";
29
30 done_testing();