File: role-with-inheritance.t

package info (click to toggle)
librole-tiny-perl 2.002004-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 454; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 519 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;
use Test::More;

{
  package R1;
  use Role::Tiny;
}
{
  package R2;
  use Role::Tiny;
}
{
  package C1;
  use Role::Tiny::With;
  with 'R1';
}
{
  package C2;
  use Role::Tiny::With;
  our @ISA=('C1');
  with 'R2';
}

ok Role::Tiny::does_role('C1','R1'), "Parent does own role";
ok !Role::Tiny::does_role('C1','R2'), "Parent does not do child's role";
ok Role::Tiny::does_role('C2','R1'), "Child does base's role";
ok Role::Tiny::does_role('C2','R2'), "Child does own role";

done_testing();