line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Interface; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
242492
|
use strict; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
55
|
|
7
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
12
|
use Test::Builder; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
77
|
|
11
|
2
|
|
|
2
|
|
922
|
use Role::Inspector; |
|
2
|
|
|
|
|
18276
|
|
|
2
|
|
|
|
|
20
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
292
|
use Exporter qw/import/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
308
|
|
15
|
|
|
|
|
|
|
our @EXPORT = qw/interface_ok/; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $Test = Test::Builder->new; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub interface_ok($$;$) { |
22
|
2
|
|
|
2
|
0
|
7198
|
my $thing = shift; |
23
|
2
|
|
|
|
|
4
|
my $interface = shift; |
24
|
2
|
|
33
|
|
|
14
|
my $test_name = shift // "$thing does interface $interface"; |
25
|
|
|
|
|
|
|
|
26
|
2
|
100
|
|
|
|
12
|
if (Role::Inspector->does_role( $thing, $interface ) ) { |
27
|
1
|
|
|
|
|
848
|
return $Test->ok( 1, $test_name ) |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
1630
|
$Test->diag("$thing does not implement the $interface interface\n"); |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
315
|
return $Test->ok( 0, $test_name ) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |