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