line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::UseAllModules; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
35320
|
use strict; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
274
|
|
4
|
10
|
|
|
10
|
|
66
|
use warnings; |
|
10
|
|
|
|
|
567
|
|
|
10
|
|
|
|
|
235
|
|
5
|
10
|
|
|
8
|
|
4357
|
use ExtUtils::Manifest qw( maniread ); |
|
10
|
|
|
|
|
71282
|
|
|
8
|
|
|
|
|
599
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
8
|
|
52
|
use Exporter; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
388
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw/Exporter/; |
12
|
|
|
|
|
|
|
our @EXPORT = qw/all_uses_ok/; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
8
|
|
3763
|
use Test::More; |
|
8
|
|
|
|
|
84707
|
|
|
8
|
|
|
|
|
64
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $RULE = qr{^lib/(.+)\.pm$}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import { |
19
|
8
|
|
|
8
|
|
478
|
shift->export_to_level(1); |
20
|
|
|
|
|
|
|
|
21
|
8
|
100
|
66
|
|
|
55
|
shift if @_ && $_[0] eq 'under'; |
22
|
8
|
|
|
|
|
19
|
my @dirs = ('lib', @_); |
23
|
8
|
|
|
|
|
11
|
my %seen; |
24
|
8
|
|
|
|
|
14
|
@dirs = grep { !$seen{$_}++ } map { s|/+$||; $_ } @dirs; |
|
14
|
|
|
|
|
90
|
|
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
26
|
|
25
|
8
|
|
|
|
|
26
|
$RULE = '^(?:'.(join '|', @dirs).')/(.+)\.pm\s*$'; |
26
|
8
|
|
|
|
|
291
|
unshift @INC, @dirs; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _get_module_list { |
30
|
8
|
100
|
66
|
8
|
|
893
|
shift if @_ && $_[0] eq 'except'; |
31
|
8
|
|
|
|
|
13
|
my @exceptions = @_; |
32
|
8
|
|
|
|
|
8
|
my @modules; |
33
|
|
|
|
|
|
|
|
34
|
8
|
|
|
|
|
27
|
my $manifest = maniread(); |
35
|
|
|
|
|
|
|
|
36
|
8
|
|
|
|
|
34
|
READ: |
37
|
8
|
|
|
|
|
1402
|
foreach my $file (keys %{ $manifest }) { |
38
|
69
|
100
|
|
|
|
292
|
if (my ($module) = $file =~ m|$RULE|) { |
39
|
16
|
|
|
|
|
27
|
$module =~ s|/|::|g; |
40
|
|
|
|
|
|
|
|
41
|
16
|
|
|
|
|
19
|
foreach my $rule (@exceptions) { |
42
|
2
|
100
|
66
|
|
|
16
|
next READ if $module eq $rule || $module =~ /$rule/; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
15
|
|
|
|
|
26
|
push @modules, $module; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
8
|
|
|
|
|
52
|
return @modules; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _planned { |
52
|
5
|
|
|
5
|
|
24
|
Test::More->builder->has_plan; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub all_uses_ok { |
56
|
5
|
100
|
|
5
|
|
121
|
unless (-f 'MANIFEST') { |
57
|
1
|
50
|
|
|
|
2
|
plan skip_all => 'no MANIFEST' unless _planned(); |
58
|
0
|
|
|
|
|
0
|
return; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
4
|
|
|
|
|
11
|
my @modules = _get_module_list(@_); |
62
|
|
|
|
|
|
|
|
63
|
4
|
100
|
|
|
|
11
|
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
|
|
|
|
7
|
plan tests => scalar @modules unless _planned(); |
68
|
|
|
|
|
|
|
|
69
|
3
|
|
|
|
|
280
|
my @failed; |
70
|
3
|
|
|
|
|
7
|
foreach my $module (@modules) { |
71
|
3
|
50
|
|
3
|
|
682
|
use_ok($module) or push @failed, $module; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
39
|
|
|
7
|
|
|
|
|
1312
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
3
|
50
|
|
|
|
2005
|
BAIL_OUT( 'failed: ' . (join ',', @failed) ) if @failed; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |