| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Install::StandardTests; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
678
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
63
|
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
58
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use File::Spec; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
27
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
29
|
use base 'Module::Install::Base'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1086
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub use_standard_tests { |
|
14
|
0
|
|
|
0
|
1
|
|
my ($self, %specs) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my %with = map { $_ => 1 } qw/compile pod pod_coverage perl_critic/; |
|
|
0
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
if (exists $specs{without}) { |
|
18
|
0
|
0
|
|
|
|
|
$specs{without} = [ $specs{without} ] unless ref $specs{without}; |
|
19
|
0
|
|
|
|
|
|
delete $with{$_} for @{ $specs{without} }; |
|
|
0
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$self->build_requires('Test::More'); |
|
23
|
0
|
|
|
|
|
|
$self->build_requires('UNIVERSAL::require'); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Unlike other tests, this is mandatory. |
|
26
|
0
|
|
|
|
|
|
$self->build_requires('Test::Compile'); |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->write_standard_test_compile; # no if; this is mandatory |
|
29
|
0
|
0
|
|
|
|
|
$self->write_standard_test_pod if $with{pod}; |
|
30
|
0
|
0
|
|
|
|
|
$self->write_standard_test_pod_coverage if $with{pod_coverage}; |
|
31
|
0
|
0
|
|
|
|
|
$self->write_standard_test_perl_critic if $with{perl_critic}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub write_test_file { |
|
36
|
0
|
|
|
0
|
1
|
|
my ($self, $filename, $code) = @_; |
|
37
|
0
|
|
|
|
|
|
$filename = File::Spec->catfile('t', $filename); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Outdent the code somewhat. Remove first empty line, if any. Then |
|
40
|
|
|
|
|
|
|
# determine the indent of the first line. Throw that amount of indenting |
|
41
|
|
|
|
|
|
|
# away from any line. This allows you to indent the code so it's visually |
|
42
|
|
|
|
|
|
|
# clearer (see methods below) while creating output that's indented more |
|
43
|
|
|
|
|
|
|
# or less correctly. Smoke result HTML pages link to the .t files, so it |
|
44
|
|
|
|
|
|
|
# looks neater. |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
$code =~ s/^ *\n//; |
|
47
|
0
|
|
|
|
|
|
(my $indent = $code) =~ s/^( *).*/$1/s; |
|
48
|
0
|
|
|
|
|
|
$code =~ s/^$indent//gm; |
|
49
|
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
print "Creating $filename\n"; |
|
51
|
0
|
0
|
|
|
|
|
open(my $fh, ">$filename") or die "can't create $filename $!"; |
|
52
|
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $perl = $^X; |
|
54
|
0
|
|
|
|
|
|
print $fh <
|
|
55
|
|
|
|
|
|
|
#!$perl -w |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
use strict; |
|
58
|
|
|
|
|
|
|
use warnings; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$code |
|
61
|
|
|
|
|
|
|
TEST |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
close $fh or die "can't close $filename $!\n"; |
|
64
|
0
|
|
|
|
|
|
$self->realclean_files($filename); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub write_standard_test_compile { |
|
69
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
70
|
0
|
|
|
|
|
|
$self->write_test_file('000_standard__compile.t', q/ |
|
71
|
|
|
|
|
|
|
BEGIN { |
|
72
|
|
|
|
|
|
|
use Test::More; |
|
73
|
|
|
|
|
|
|
eval "use Test::Compile"; |
|
74
|
|
|
|
|
|
|
Test::More->builder->BAIL_OUT( |
|
75
|
|
|
|
|
|
|
"Test::Compile required for testing compilation") if $@; |
|
76
|
|
|
|
|
|
|
all_pm_files_ok(); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
/); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub write_standard_test_pod { |
|
83
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
84
|
0
|
|
|
|
|
|
$self->write_test_file('000_standard__pod.t', q/ |
|
85
|
|
|
|
|
|
|
use Test::More; |
|
86
|
|
|
|
|
|
|
eval "use Test::Pod"; |
|
87
|
|
|
|
|
|
|
plan skip_all => "Test::Pod required for testing POD" if $@; |
|
88
|
|
|
|
|
|
|
all_pod_files_ok(); |
|
89
|
|
|
|
|
|
|
/); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub write_standard_test_pod_coverage { |
|
94
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
95
|
0
|
|
|
|
|
|
$self->write_test_file('000_standard__pod_coverage.t', q/ |
|
96
|
|
|
|
|
|
|
use Test::More; |
|
97
|
|
|
|
|
|
|
eval "use Test::Pod::Coverage"; |
|
98
|
|
|
|
|
|
|
plan skip_all => |
|
99
|
|
|
|
|
|
|
"Test::Pod::Coverage required for testing POD coverage" if $@; |
|
100
|
|
|
|
|
|
|
all_pod_coverage_ok(); |
|
101
|
|
|
|
|
|
|
/); |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub write_standard_test_perl_critic { |
|
106
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
107
|
0
|
|
|
|
|
|
$self->write_test_file('000_standard__perl_critic.t', q/ |
|
108
|
|
|
|
|
|
|
use FindBin '$Bin'; |
|
109
|
|
|
|
|
|
|
use File::Spec; |
|
110
|
|
|
|
|
|
|
use UNIVERSAL::require; |
|
111
|
|
|
|
|
|
|
use Test::More; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
plan skip_all => |
|
114
|
|
|
|
|
|
|
'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.' |
|
115
|
|
|
|
|
|
|
unless $ENV{TEST_AUTHOR}; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my %opt; |
|
118
|
|
|
|
|
|
|
my $rc_file = File::Spec->catfile($Bin, 'perlcriticrc'); |
|
119
|
|
|
|
|
|
|
$opt{'-profile'} = $rc_file if -r $rc_file; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
if (Perl::Critic->require('1.078') && |
|
122
|
|
|
|
|
|
|
Test::Perl::Critic->require && |
|
123
|
|
|
|
|
|
|
Test::Perl::Critic->import(%opt)) { |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
all_critic_ok("lib"); |
|
126
|
|
|
|
|
|
|
} else { |
|
127
|
|
|
|
|
|
|
plan skip_all => $@; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
/); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__END__ |