line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::MethodName; |
2
|
2
|
|
|
2
|
|
101028
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
86
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
13263
|
use Test::More qw//; |
|
2
|
|
|
|
|
34147
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
3043
|
use Module::Pluggable::Object; |
|
2
|
|
|
|
|
42953
|
|
|
2
|
|
|
|
|
88
|
|
6
|
2
|
|
|
2
|
|
3558
|
use List::MoreUtils qw/any/; |
|
2
|
|
|
|
|
3390
|
|
|
2
|
|
|
|
|
198
|
|
7
|
2
|
|
|
2
|
|
1645
|
use Module::Functions qw//; |
|
2
|
|
|
|
|
22593
|
|
|
2
|
|
|
|
|
291
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
20
|
use Exporter; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
5385
|
|
12
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
13
|
|
|
|
|
|
|
our @EXPORT = qw/method_ok all_methods_ok/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub method_ok { |
16
|
1
|
|
|
1
|
1
|
2
|
my ($module, $test_code) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
79
|
eval "require $module"; ## no critic |
19
|
1
|
50
|
|
|
|
109
|
if (my $e = $@) { |
20
|
0
|
|
|
|
|
0
|
Test::More::fail("fail to require $module: $e"); |
21
|
0
|
|
|
|
|
0
|
return; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
6
|
Test::More::note("test methods in $module"); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
668
|
for my $function ( Module::Functions::get_full_functions($module) ) { |
27
|
2
|
|
|
|
|
631
|
Test::More::ok( $test_code->($function), "function: $function" ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub all_methods_ok { |
32
|
1
|
|
|
1
|
1
|
12
|
my ($search_path, $test_code, %param) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# this code was borrowed from Test::LoadAllModules |
35
|
1
|
50
|
|
|
|
4
|
unless ($search_path) { |
36
|
0
|
|
|
|
|
0
|
Test::More::plan skip_all => 'no search path'; |
37
|
0
|
|
|
|
|
0
|
exit; |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
7
|
Test::More::plan('no_plan'); |
40
|
1
|
50
|
|
|
|
77
|
my @exceptions = @{ $param{except} || [] }; |
|
1
|
|
|
|
|
11
|
|
41
|
1
|
50
|
|
|
|
3
|
my @lib = @{ $param{lib} || [ 'lib' ] }; |
|
1
|
|
|
|
|
9
|
|
42
|
1
|
|
|
|
|
3
|
foreach my $module ( |
|
1
|
|
|
|
|
178
|
|
43
|
|
|
|
|
|
|
grep { !_is_excluded( $_, @exceptions ) } |
44
|
|
|
|
|
|
|
sort do { |
45
|
1
|
|
|
|
|
4
|
local @INC = @lib; |
46
|
1
|
|
|
|
|
12
|
my $finder = Module::Pluggable::Object->new( |
47
|
|
|
|
|
|
|
search_path => $search_path ); |
48
|
1
|
|
|
|
|
11
|
( $search_path, $finder->plugins ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
) |
51
|
|
|
|
|
|
|
{ |
52
|
1
|
|
|
|
|
5
|
method_ok($module, $test_code); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _is_excluded { |
57
|
1
|
|
|
1
|
|
3
|
my ( $module, @exceptions ) = @_; |
58
|
1
|
0
|
|
0
|
|
21
|
any { $module eq $_ || $module =~ /$_/ } @exceptions; |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |