line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package Test::UseAllModules;
|
3
|
1
|
|
|
1
|
|
623
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
1340
|
use warnings;
|
|
1
|
|
|
|
|
11738
|
|
|
1
|
|
|
|
|
91
|
|
6
|
|
|
|
|
|
|
use ExtUtils::Manifest qw( maniread );
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.12';
|
9
|
1
|
|
|
1
|
|
10
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
10
|
|
|
|
|
|
|
use Exporter;
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw/Exporter/;
|
13
|
|
|
|
|
|
|
our @EXPORT = qw/all_uses_ok/;
|
14
|
1
|
|
|
1
|
|
1378
|
|
|
1
|
|
|
|
|
20016
|
|
|
1
|
|
|
|
|
10
|
|
15
|
|
|
|
|
|
|
use Test::More;
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $RULE = qr{^lib/(.+)\.pm$};
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
63
|
sub import {
|
20
|
|
|
|
|
|
|
shift->export_to_level(1);
|
21
|
1
|
50
|
33
|
|
|
5
|
|
22
|
1
|
|
|
|
|
3
|
shift if @_ && $_[0] eq 'under';
|
23
|
1
|
|
|
|
|
2
|
my @dirs = ('lib', @_);
|
24
|
1
|
|
|
|
|
2
|
my %seen;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
25
|
1
|
|
|
|
|
3
|
@dirs = grep { !$seen{$_}++ } map { s|/+$||; $_ } @dirs;
|
26
|
1
|
|
|
|
|
27
|
$RULE = '^(?:'.(join '|', @dirs).')/(.+)\.pm\s*$';
|
27
|
|
|
|
|
|
|
unshift @INC, @dirs;
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
1
|
50
|
33
|
1
|
|
5
|
sub _get_module_list {
|
31
|
1
|
|
|
|
|
2
|
shift if @_ && $_[0] eq 'except';
|
32
|
1
|
|
|
|
|
2
|
my @exceptions = @_;
|
33
|
|
|
|
|
|
|
my @modules;
|
34
|
1
|
|
|
|
|
5
|
|
35
|
|
|
|
|
|
|
my $manifest = maniread();
|
36
|
1
|
|
|
|
|
6
|
|
37
|
1
|
|
|
|
|
328
|
READ:
|
38
|
30
|
100
|
|
|
|
83
|
foreach my $file (keys %{ $manifest }) {
|
39
|
1
|
|
|
|
|
11
|
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
|
|
|
|
|
3
|
|
46
|
|
|
|
|
|
|
push @modules, $module;
|
47
|
|
|
|
|
|
|
}
|
48
|
1
|
|
|
|
|
9
|
}
|
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
|
|
|
|
|
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
|
|
|
|
|
145
|
|
68
|
1
|
|
|
|
|
2
|
my @failed;
|
69
|
1
|
50
|
|
1
|
|
537
|
foreach my $module (@modules) {
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
4
|
|
70
|
|
|
|
|
|
|
use_ok($module) or push @failed, $module;
|
71
|
|
|
|
|
|
|
}
|
72
|
1
|
50
|
|
|
|
770
|
|
73
|
|
|
|
|
|
|
BAIL_OUT( 'failed: ' . (join ',', @failed) ) if @failed;
|
74
|
|
|
|
|
|
|
}
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1;
|
77
|
|
|
|
|
|
|
__END__
|