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