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