line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Yath; |
2
|
22
|
|
|
22
|
|
126485
|
use strict; |
|
22
|
|
|
|
|
43
|
|
|
22
|
|
|
|
|
696
|
|
3
|
22
|
|
|
22
|
|
149
|
use warnings; |
|
22
|
|
|
|
|
43
|
|
|
22
|
|
|
|
|
1230
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000012'; |
6
|
|
|
|
|
|
|
|
7
|
22
|
|
|
22
|
|
17139
|
use Test2::Util::HashBase qw/args harness files exclude renderers/; |
|
22
|
|
|
|
|
53215
|
|
|
22
|
|
|
|
|
174
|
|
8
|
22
|
|
|
22
|
|
17592
|
use Test2::Util qw/pkg_to_file/; |
|
22
|
|
|
|
|
41162
|
|
|
22
|
|
|
|
|
2284
|
|
9
|
|
|
|
|
|
|
|
10
|
22
|
|
|
22
|
|
14662
|
use Test2::Harness; |
|
22
|
|
|
|
|
45
|
|
|
22
|
|
|
|
|
528
|
|
11
|
22
|
|
|
22
|
|
89
|
use Test2::Harness::Parser; |
|
22
|
|
|
|
|
22
|
|
|
22
|
|
|
|
|
350
|
|
12
|
22
|
|
|
22
|
|
66
|
use Test2::Harness::Runner; |
|
22
|
|
|
|
|
2
|
|
|
22
|
|
|
|
|
374
|
|
13
|
|
|
|
|
|
|
|
14
|
22
|
|
|
22
|
|
15925
|
use Getopt::Long qw/GetOptionsFromArray/; |
|
22
|
|
|
|
|
156472
|
|
|
22
|
|
|
|
|
67
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub run { |
17
|
44
|
|
|
44
|
1
|
7789
|
my $self = shift; |
18
|
44
|
|
|
|
|
159
|
my $results = $self->{+HARNESS}->run(@{$self->{+FILES}}); |
|
44
|
|
|
|
|
323
|
|
19
|
|
|
|
|
|
|
|
20
|
24
|
|
|
|
|
1247
|
$_->summary($results) for @{$self->{+RENDERERS}}; |
|
24
|
|
|
|
|
297
|
|
21
|
|
|
|
|
|
|
|
22
|
24
|
|
|
|
|
117
|
my $failed = grep {!$_->passed} @$results; |
|
420
|
|
|
|
|
877
|
|
23
|
24
|
|
|
|
|
68989
|
return $failed; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub init { |
27
|
56
|
|
|
56
|
0
|
142920
|
my $self = shift; |
28
|
56
|
|
100
|
|
|
345
|
$self->{+ARGS} ||= []; |
29
|
56
|
|
|
|
|
121
|
my @args = @{$self->{+ARGS}}; |
|
56
|
|
|
|
|
331
|
|
30
|
|
|
|
|
|
|
|
31
|
56
|
|
|
|
|
102
|
my (%env, @libs, @switches); |
32
|
56
|
|
|
|
|
396
|
my %harness_args = ( |
33
|
|
|
|
|
|
|
env_vars => \%env, |
34
|
|
|
|
|
|
|
libs => \@libs, |
35
|
|
|
|
|
|
|
switches => \@switches, |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
parser_class => '+Test2::Harness::Parser', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
56
|
|
|
|
|
142
|
my (@exclude, @render, @preload); |
41
|
56
|
50
|
|
|
|
324
|
my $color = -t STDOUT ? 1 : 0; |
42
|
56
|
|
|
|
|
100
|
my $jobs = 1; |
43
|
56
|
|
|
|
|
99
|
my $merge = 0; |
44
|
56
|
|
|
|
|
119
|
my $verbose = 0; |
45
|
56
|
|
|
|
|
98
|
my $quiet = 0; |
46
|
|
|
|
|
|
|
|
47
|
56
|
|
|
|
|
84
|
my $runner_class = '+Test2::Harness::Runner'; |
48
|
|
|
|
|
|
|
|
49
|
56
|
|
|
|
|
361
|
Getopt::Long::Configure("bundling"); |
50
|
|
|
|
|
|
|
GetOptionsFromArray \@args => ( |
51
|
|
|
|
|
|
|
'l|lib' => sub { |
52
|
2
|
|
|
2
|
|
1297
|
push @libs, 'lib'; |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
'b|blib' => sub { |
55
|
2
|
|
|
2
|
|
125
|
push @libs, 'blib/lib', 'blib/arch'; |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
'I|include=s@' => \@libs, |
58
|
|
|
|
|
|
|
'R|renderer=s@' => \@render, |
59
|
|
|
|
|
|
|
'L|preload=s@' => \@preload, |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
'c|color=i' => \$color, |
62
|
|
|
|
|
|
|
'h|help' => \&help, |
63
|
|
|
|
|
|
|
'j|jobs=i' => \$jobs, |
64
|
|
|
|
|
|
|
'm|merge' => \$merge, |
65
|
|
|
|
|
|
|
'q|quiet' => \$quiet, |
66
|
|
|
|
|
|
|
'v|verbose' => \$verbose, |
67
|
|
|
|
|
|
|
'x|exclude=s@' => \@exclude, |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
'parser|parser_class=s' => \$harness_args{parser_class}, |
70
|
|
|
|
|
|
|
'runner|runner_class=s' => \$runner_class, |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
'S|switch=s@' => sub { |
73
|
6
|
|
|
6
|
|
2943
|
push @switches => split '=', $_[1]; |
74
|
|
|
|
|
|
|
}, |
75
|
56
|
50
|
|
|
|
3262
|
) or die "Could not parse the command line options given.\n"; |
76
|
|
|
|
|
|
|
|
77
|
56
|
100
|
100
|
|
|
78945
|
die "You cannot combine preload (-L) with switches (-S).\n" |
78
|
|
|
|
|
|
|
if @preload && @switches; |
79
|
|
|
|
|
|
|
|
80
|
54
|
100
|
|
|
|
231
|
unshift @render => 'EventStream' |
81
|
|
|
|
|
|
|
unless $quiet; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
{ |
84
|
54
|
|
|
|
|
95
|
local $ENV{TB_NO_EARLY_INIT} = 1; |
|
54
|
|
|
|
|
474
|
|
85
|
54
|
|
|
|
|
551
|
local @INC = (@libs, @INC); |
86
|
54
|
|
|
|
|
265
|
load_module('', $_) for @preload; |
87
|
54
|
50
|
|
|
|
1253
|
load_module('Test2::Harness::Runner::', $runner_class) if $runner_class; |
88
|
54
|
50
|
|
|
|
1551
|
load_module('Test2::Harness::Parser::', $harness_args{parser_class}) if $harness_args{parser_class}; |
89
|
54
|
|
|
|
|
1232
|
load_module('Test2::Harness::Renderer::', $_) for @render; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
54
|
|
|
|
|
1379
|
$harness_args{jobs} = $jobs; |
93
|
54
|
100
|
|
|
|
708
|
$harness_args{runner} = $runner_class->new(merge => $merge, via => @preload ? 'do' : 'open3'); |
94
|
|
|
|
|
|
|
|
95
|
54
|
|
|
|
|
282
|
my @renderers; |
96
|
54
|
|
|
|
|
143
|
for my $r (@render) { |
97
|
58
|
|
|
|
|
441
|
push @renderers => $r->new( |
98
|
|
|
|
|
|
|
color => $color, |
99
|
|
|
|
|
|
|
parallel => $jobs, |
100
|
|
|
|
|
|
|
verbose => $verbose, |
101
|
|
|
|
|
|
|
); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
54
|
|
|
|
|
319
|
$harness_args{listeners} = [ map { $_->listen } @renderers ]; |
|
58
|
|
|
|
|
283
|
|
105
|
|
|
|
|
|
|
|
106
|
54
|
|
|
|
|
446
|
$self->{+RENDERERS} = \@renderers; |
107
|
54
|
|
|
|
|
510
|
$self->{+HARNESS} = Test2::Harness->new(%harness_args, verbose => $verbose); |
108
|
|
|
|
|
|
|
|
109
|
54
|
|
|
|
|
312
|
$self->{+EXCLUDE} = \@exclude; |
110
|
54
|
|
|
|
|
237
|
$self->{+FILES} = $self->expand_files(@args); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub load_module { |
114
|
191
|
|
|
191
|
1
|
2323
|
my $prefix = shift; |
115
|
191
|
100
|
|
|
|
733
|
$prefix = '' if $_[0] =~ s/^\+//; |
116
|
191
|
100
|
|
|
|
477
|
$_[0] = "${prefix}$_[0]" if $prefix; |
117
|
191
|
|
|
|
|
642
|
require(pkg_to_file($_[0])); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub expand_files { |
121
|
62
|
|
|
62
|
1
|
830
|
my $self = shift; |
122
|
|
|
|
|
|
|
|
123
|
62
|
|
|
|
|
132
|
my @in = @_; |
124
|
62
|
100
|
66
|
|
|
394
|
push @in => 't' if !@in && -d 't'; |
125
|
|
|
|
|
|
|
|
126
|
62
|
|
|
|
|
86
|
my (@files, @dirs); |
127
|
62
|
|
|
|
|
150
|
for my $f (@in) { |
128
|
104
|
100
|
50
|
|
|
1250
|
push @files => $f and next if -f $f; |
129
|
100
|
50
|
50
|
|
|
858
|
push @dirs => $f and next if -d $f; |
130
|
0
|
|
|
|
|
0
|
die "'$f' is not a valid test file or directory" |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
62
|
100
|
|
|
|
136
|
if (@dirs) { |
134
|
58
|
|
|
|
|
401
|
require File::Find; |
135
|
|
|
|
|
|
|
File::Find::find( |
136
|
|
|
|
|
|
|
sub { |
137
|
22
|
|
|
22
|
|
15582
|
no warnings 'once'; |
|
22
|
|
|
|
|
44
|
|
|
22
|
|
|
|
|
4456
|
|
138
|
2224
|
100
|
|
2224
|
|
75630
|
push @files => $File::Find::name if -f $_ & m/\.t2?$/; |
139
|
|
|
|
|
|
|
}, |
140
|
|
|
|
|
|
|
@dirs |
141
|
58
|
|
|
|
|
5578
|
); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
62
|
|
|
|
|
318
|
my $exclude = $self->{+EXCLUDE}; |
145
|
62
|
100
|
|
|
|
235
|
if (@$exclude) { |
146
|
|
|
|
|
|
|
@files = grep { |
147
|
46
|
|
|
|
|
113
|
my $file = $_; |
|
872
|
|
|
|
|
670
|
|
148
|
872
|
|
|
|
|
781
|
grep { $file !~ m/$_/ } @$exclude; |
|
874
|
|
|
|
|
2105
|
|
149
|
|
|
|
|
|
|
} @files; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
62
|
|
|
|
|
633
|
return \@files; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub help { |
156
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
print <<" EOT"; |
159
|
|
|
|
|
|
|
Usage: $0 [OPTIONS] File1 File2 Directory ... |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Common Options: |
162
|
|
|
|
|
|
|
-l --lib Add lib/ to \@INC. |
163
|
|
|
|
|
|
|
-b --blib Add blib/lib and blib/arch to \@INC. |
164
|
|
|
|
|
|
|
-I[dir] --include="dir" Add directories to \@INC. |
165
|
|
|
|
|
|
|
-L[Module] --preload="Module" Add a module to preload. (Prefork) |
166
|
|
|
|
|
|
|
-R[name] --renderer="name" Add a renderer. (See [name] section) |
167
|
|
|
|
|
|
|
-S[s=val] --switch="s=val" Add switches to use when executing perl. |
168
|
|
|
|
|
|
|
-c[n] --color=n Override the default color level. (0=off) |
169
|
|
|
|
|
|
|
-h --help Show this usage help. |
170
|
|
|
|
|
|
|
-j[n] --jobs=n How many tests to run concurrently. |
171
|
|
|
|
|
|
|
-m --merge Merge STDERR and STDOUT from test files. |
172
|
|
|
|
|
|
|
-q --quiet Do not use the default renderer. |
173
|
|
|
|
|
|
|
-v --verbose Show every event, not just failures and diag. |
174
|
|
|
|
|
|
|
-x[pattern] --exclude=[pattern] Exclude any files that match the pattern. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Other Options: |
177
|
|
|
|
|
|
|
--parser=[name] --parser_class=[name] Override the default parser. |
178
|
|
|
|
|
|
|
--runner=[name] --runner_class=[name] Override the default runner. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
[name] |
181
|
|
|
|
|
|
|
-R[name] --renderer="name" |
182
|
|
|
|
|
|
|
'Test2::Harness::Renderer::[name]' is implied. Prefix with '+' to give an |
183
|
|
|
|
|
|
|
absolute module name. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
--parser=[name] --parser_class="name" |
186
|
|
|
|
|
|
|
'Test2::Harness::Parser::[name]' is implied. Prefix with '+' to give an |
187
|
|
|
|
|
|
|
absolute module name. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
--runner=[name] --runner_class="name" |
190
|
|
|
|
|
|
|
'Test2::Harness::Runner::[name]' is implied. Prefix with '+' to give an |
191
|
|
|
|
|
|
|
absolute module name. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
EOT |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
|
exit 0; |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
1; |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
__END__ |