line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::UseAllModules; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
66800
|
use strict; |
|
10
|
|
|
|
|
50
|
|
|
10
|
|
|
|
|
305
|
|
4
|
10
|
|
|
10
|
|
77
|
use warnings; |
|
10
|
|
|
|
|
617
|
|
|
10
|
|
|
|
|
294
|
|
5
|
10
|
|
|
8
|
|
20971
|
use ExtUtils::Manifest qw( maniread ); |
|
10
|
|
|
|
|
118620
|
|
|
8
|
|
|
|
|
888
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
85
|
use Exporter; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
7447
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
12
|
|
|
|
|
|
|
our @EXPORT = qw/all_uses_ok/; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
8
|
|
7444
|
use Test::More; |
|
8
|
|
|
|
|
158984
|
|
|
8
|
|
|
|
|
94
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $RULE = qr{^lib/(.+)\.pm$}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import { |
19
|
8
|
|
|
8
|
|
619
|
shift->export_to_level(1); |
20
|
|
|
|
|
|
|
|
21
|
8
|
100
|
66
|
|
|
69
|
shift if @_ && $_[0] eq 'under'; |
22
|
8
|
|
|
|
|
25
|
my @dirs = ('lib', @_); |
23
|
8
|
|
|
|
|
15
|
my %seen; |
24
|
8
|
|
|
|
|
19
|
@dirs = grep { !$seen{$_}++ } map { s|/+$||; $_ } @dirs; |
|
14
|
|
|
|
|
125
|
|
|
14
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
36
|
|
25
|
8
|
|
|
|
|
32
|
$RULE = '^(?:'.(join '|', @dirs).')/(.+)\.pm\s*$'; |
26
|
8
|
|
|
|
|
389
|
unshift @INC, @dirs; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _get_module_list { |
30
|
8
|
100
|
66
|
8
|
|
2144
|
shift if @_ && $_[0] eq 'except'; |
31
|
8
|
|
|
|
|
16
|
my @exceptions = @_; |
32
|
8
|
|
|
|
|
15
|
my @modules; |
33
|
|
|
|
|
|
|
|
34
|
8
|
|
|
|
|
38
|
my $manifest = maniread(); |
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
|
|
43
|
READ: |
37
|
8
|
|
|
|
|
1873
|
foreach my $file (keys %{ $manifest }) { |
38
|
71
|
100
|
|
|
|
399
|
if (my ($module) = $file =~ m|$RULE|) { |
39
|
16
|
|
|
|
|
41
|
$module =~ s|/|::|g; |
40
|
|
|
|
|
|
|
|
41
|
16
|
|
|
|
|
30
|
foreach my $rule (@exceptions) { |
42
|
2
|
100
|
66
|
|
|
22
|
next READ if $module eq $rule || $module =~ /$rule/; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
15
|
|
|
|
|
41
|
push @modules, $module; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
8
|
|
|
|
|
66
|
return @modules; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _planned { |
52
|
5
|
|
|
5
|
|
33
|
Test::More->builder->has_plan; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub all_uses_ok { |
56
|
5
|
100
|
|
5
|
|
193
|
unless (-f 'MANIFEST') { |
57
|
1
|
50
|
|
|
|
3
|
plan skip_all => 'no MANIFEST' unless _planned(); |
58
|
0
|
|
|
|
|
0
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
17
|
my @modules = _get_module_list(@_); |
62
|
|
|
|
|
|
|
|
63
|
4
|
100
|
|
|
|
17
|
unless (@modules) { |
64
|
1
|
50
|
|
|
|
2
|
plan skip_all => 'no .pm files are found under the lib directory' unless _planned(); |
65
|
0
|
|
|
|
|
0
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
3
|
100
|
|
|
|
8
|
plan tests => scalar @modules unless _planned(); |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
|
|
831
|
my @failed; |
70
|
3
|
|
|
|
|
7
|
foreach my $module (@modules) { |
71
|
3
|
50
|
|
3
|
|
945
|
use_ok($module) or push @failed, $module; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
46
|
|
|
7
|
|
|
|
|
1675
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
3
|
50
|
|
|
|
3181
|
BAIL_OUT( 'failed: ' . (join ',', @failed) ) if @failed; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |