File: does.t

package info (click to toggle)
libmoo-perl 2.002005-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 856 kB
  • ctags: 192
  • sloc: perl: 2,561; makefile: 6
file content (47 lines) | stat: -rw-r--r-- 733 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use Moo::_strictures;
use Test::More;

BEGIN {
  package TestParent;
  use Moo;
}

BEGIN {
  package TestClass;
  use Moo;
  extends 'TestParent';

  has attr1 => (is => 'ro');
}

BEGIN {
  ok !TestClass->does('TestRole'),
    "->does returns false for arbitrary role";
  ok !$INC{'Moo/Role.pm'},
    "Moo::Role not loaded by does";
}

BEGIN {
  package TestRole;
  use Moo::Role;

  has attr2 => (is => 'ro');
}

BEGIN {
  package TestClass;
  with 'TestRole';
}

BEGIN {
  ok +TestClass->does('TestRole'),
    "->does returns true for composed role";

  ok +TestClass->DOES('TestRole'),
    "->DOES returns true for composed role";

  ok +TestClass->DOES('TestParent'),
    "->DOES returns true for parent class";
}

done_testing;