line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package Test::Compile; |
3
|
1
|
|
|
1
|
|
838
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
6
|
1
|
|
|
1
|
|
16
|
use Test::Builder; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
7
|
1
|
|
|
1
|
|
520
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
8
|
|
|
|
|
|
|
use UNIVERSAL::require; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $Test = Test::Builder->new; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
7
|
sub import { |
18
|
1
|
|
|
|
|
3
|
my $self = shift; |
19
|
|
|
|
|
|
|
my $caller = caller; |
20
|
1
|
|
|
|
|
3
|
|
21
|
1
|
|
|
1
|
|
91
|
for my $func ( qw( pm_file_ok all_pm_files all_pm_files_ok ) ) { |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
733
|
|
22
|
3
|
|
|
|
|
6
|
no strict 'refs'; |
|
3
|
|
|
|
|
18
|
|
23
|
|
|
|
|
|
|
*{$caller."::".$func} = \&$func; |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
5
|
|
26
|
1
|
|
|
|
|
11
|
$Test->exported_to($caller); |
27
|
|
|
|
|
|
|
$Test->plan(@_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
11
|
|
|
11
|
1
|
17
|
sub pm_file_ok { |
32
|
11
|
50
|
|
|
|
36
|
my $file = shift; |
33
|
|
|
|
|
|
|
my $name = @_ ? shift : "Compile test for $file"; |
34
|
11
|
50
|
|
|
|
285
|
|
35
|
0
|
|
|
|
|
0
|
if (!-f $file) { |
36
|
0
|
|
|
|
|
0
|
$Test->ok(0, $name); |
37
|
0
|
|
|
|
|
0
|
$Test->diag("$file does not exist"); |
38
|
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
11
|
|
|
|
|
15
|
|
41
|
11
|
|
|
|
|
65
|
my $module = $file; |
42
|
11
|
|
|
|
|
47
|
$module =~ s!^(blib/)?lib/!!; |
43
|
11
|
|
|
|
|
129
|
$module =~ s!/!::!g; |
44
|
|
|
|
|
|
|
$module =~ s/\.pm$//; |
45
|
11
|
|
|
|
|
17
|
|
46
|
11
|
|
|
|
|
234
|
my $ok = 1; |
47
|
11
|
50
|
|
|
|
25
|
$module->use; |
48
|
|
|
|
|
|
|
$ok = 0 if $@; |
49
|
11
|
|
|
|
|
14
|
|
50
|
11
|
50
|
|
|
|
24
|
my $diag = ''; |
51
|
0
|
|
|
|
|
0
|
unless ($ok) { |
52
|
|
|
|
|
|
|
$diag = "couldn't use $module ($file): $@"; |
53
|
|
|
|
|
|
|
} |
54
|
11
|
|
|
|
|
43
|
|
55
|
11
|
50
|
|
|
|
5289
|
$Test->ok($ok, $name); |
56
|
11
|
|
|
|
|
43
|
$Test->diag($diag) unless $ok; |
57
|
|
|
|
|
|
|
$ok; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
1
|
50
|
|
1
|
1
|
21
|
sub all_pm_files_ok { |
62
|
|
|
|
|
|
|
my @files = @_ ? @_ : all_pm_files(); |
63
|
1
|
|
|
|
|
7
|
|
64
|
|
|
|
|
|
|
$Test->plan(tests => scalar @files); |
65
|
1
|
|
|
|
|
137
|
|
66
|
1
|
|
|
|
|
3
|
my $ok = 1; |
67
|
11
|
50
|
|
|
|
25
|
for (@files) { |
68
|
|
|
|
|
|
|
pm_file_ok($_) or undef $ok; |
69
|
1
|
|
|
|
|
2252
|
} |
70
|
|
|
|
|
|
|
$ok; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
1
|
50
|
|
1
|
1
|
4
|
sub all_pm_files { |
75
|
1
|
|
|
|
|
2
|
my @queue = @_ ? @_ : _starting_points(); |
76
|
|
|
|
|
|
|
my @pm; |
77
|
1
|
|
|
|
|
4
|
|
78
|
37
|
|
|
|
|
50
|
while ( @queue ) { |
79
|
37
|
100
|
|
|
|
488
|
my $file = shift @queue; |
80
|
18
|
|
|
|
|
33
|
if ( -d $file ) { |
81
|
18
|
50
|
|
|
|
359
|
local *DH; |
82
|
18
|
|
|
|
|
191
|
opendir DH, $file or next; |
83
|
18
|
|
|
|
|
161
|
my @newfiles = readdir DH; |
84
|
|
|
|
|
|
|
closedir DH; |
85
|
18
|
|
|
|
|
198
|
|
86
|
18
|
50
|
|
|
|
31
|
@newfiles = File::Spec->no_upwards(@newfiles); |
|
36
|
|
|
|
|
147
|
|
87
|
|
|
|
|
|
|
@newfiles = grep { $_ ne "CVS" && $_ ne ".svn" } @newfiles; |
88
|
18
|
|
|
|
|
27
|
|
89
|
36
|
|
|
|
|
243
|
for my $newfile (@newfiles) { |
90
|
36
|
100
|
|
|
|
525
|
my $filename = File::Spec->catfile($file, $newfile); |
91
|
19
|
|
|
|
|
59
|
if (-f $filename) { |
92
|
|
|
|
|
|
|
push @queue, $filename; |
93
|
17
|
|
|
|
|
115
|
} else { |
94
|
|
|
|
|
|
|
push @queue, File::Spec->catdir($file, $newfile); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
37
|
100
|
|
|
|
485
|
} |
98
|
19
|
100
|
|
|
|
85
|
if (-f $file) { |
99
|
|
|
|
|
|
|
push @pm, $file if $file =~ /\.pm$/; |
100
|
|
|
|
|
|
|
} |
101
|
1
|
|
|
|
|
5
|
} |
102
|
|
|
|
|
|
|
return @pm; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
1
|
50
|
|
1
|
|
22
|
sub _starting_points { |
107
|
0
|
|
|
|
|
|
return 'blib' if -e 'blib'; |
108
|
|
|
|
|
|
|
return 'lib'; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |