line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Aggregate::Builder; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
30
|
use strict; |
|
7
|
|
|
|
|
37
|
|
|
7
|
|
|
|
|
179
|
|
4
|
7
|
|
|
7
|
|
113
|
use warnings; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
595
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf-8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::Aggregate::Builder - Internal overrides for Test::Builder. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.373 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.373'; |
19
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Test::Aggregate::Builder; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 DESCRIPTION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
B<WARNING>: This module is for internal use only. DO NOT USE DIRECTLY. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
7
|
|
|
7
|
|
287
|
BEGIN { $ENV{TEST_AGGREGATE} = 1 } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
END { # for VMS |
34
|
7
|
|
|
7
|
|
1551
|
delete $ENV{TEST_AGGREGATE}; |
35
|
|
|
|
|
|
|
} |
36
|
7
|
|
|
7
|
|
62
|
use Test::Builder; |
|
7
|
|
|
|
|
8
|
|
|
7
|
|
|
|
|
305
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
my $DONE_TESTING; |
40
|
|
|
|
|
|
|
BEGIN { |
41
|
7
|
|
|
7
|
|
25
|
no warnings 'redefine'; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
1441
|
|
42
|
7
|
50
|
|
7
|
|
93
|
if ( Test::Builder->can('done_testing') ) { |
43
|
7
|
|
|
|
|
18
|
$DONE_TESTING = \&Test::Builder::done_testing; |
44
|
|
|
|
|
|
|
*Test::Builder::done_testing = sub { |
45
|
6
|
|
|
6
|
|
4016
|
my ( $self, $num_tests ) = @_; |
46
|
|
|
|
|
|
|
|
47
|
6
|
50
|
|
|
|
64
|
$self->expected_tests( defined $num_tests |
48
|
|
|
|
|
|
|
? $num_tests |
49
|
|
|
|
|
|
|
: $self->current_test |
50
|
|
|
|
|
|
|
); |
51
|
6
|
|
|
|
|
192
|
return; |
52
|
7
|
|
|
|
|
33
|
}; |
53
|
7
|
|
|
|
|
20
|
my $output_plan = \&Test::Builder::_output_plan; |
54
|
|
|
|
|
|
|
*Test::Builder::_output_plan = sub { |
55
|
5
|
50
|
|
5
|
|
197
|
return unless $_[0]->{Done_Testing}; |
56
|
5
|
|
|
|
|
342
|
goto $output_plan; |
57
|
7
|
|
|
|
|
773
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else { |
60
|
|
|
|
|
|
|
*Test::Builder::_plan_check = sub { |
61
|
0
|
|
|
|
|
0
|
my $self = shift; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Will this break under threads? |
64
|
0
|
|
|
|
|
0
|
$self->{Expected_Tests} = $self->{Curr_Test} + 1; |
65
|
0
|
|
|
|
|
0
|
}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
END { |
69
|
7
|
|
|
7
|
|
2553
|
my $tb = Test::Builder->new; |
70
|
7
|
|
|
|
|
116
|
$tb->{'Test::Aggregate::Builder'}{ignore_timing_blocks} = 1; |
71
|
7
|
|
|
|
|
74
|
my $tests = $tb->current_test; |
72
|
7
|
|
|
|
|
145
|
$tb->expected_tests($tests); |
73
|
7
|
50
|
|
|
|
67
|
if ( $DONE_TESTING ) { |
74
|
7
|
|
|
|
|
76
|
$tb->$DONE_TESTING($tests); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
else { |
77
|
0
|
0
|
|
|
|
0
|
$tb->_print("1..$tests\n") unless $tb->{Have_Output_Plan}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
7
|
|
|
7
|
|
34
|
no warnings 'redefine'; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
440
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# The following is done to get around the fact that deferred plans are not |
85
|
|
|
|
|
|
|
# supported. Unfortunately, there's no clean way to override this, but this |
86
|
|
|
|
|
|
|
# allows us to minimize the monkey patching. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# XXX We fully-qualify the sub names because PAUSE won't index what it thinks |
89
|
|
|
|
|
|
|
# is an attempt to hijack the Test::Builder namespace. |
90
|
|
|
|
|
|
|
|
91
|
25
|
|
|
25
|
1
|
905
|
sub Test::Builder::no_header { 1 } |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
{ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# prevent the 'you tried to plan twice' errors |
96
|
|
|
|
|
|
|
my $plan; |
97
|
7
|
|
|
7
|
|
1569
|
BEGIN { $plan = \&Test::Builder::plan } |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
our $skip = \1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub Test::Builder::plan { |
102
|
37
|
|
|
37
|
1
|
2019147
|
delete $_[0]->{Have_Plan}; |
103
|
37
|
|
100
|
|
|
143
|
$_[0]->{'Test::Aggregate::Builder'} ||= {}; |
104
|
37
|
|
|
|
|
62
|
my $tab_builder = $_[0]->{'Test::Aggregate::Builder'}; |
105
|
37
|
100
|
100
|
|
|
190
|
if ( 'skip_all' eq ( $_[1] || '' ) ) { |
106
|
4
|
|
|
|
|
14
|
my $callpack = caller(1); |
107
|
4
|
|
|
|
|
14
|
$tab_builder->{skip_all}{$callpack} = $_[2]; |
108
|
4
|
|
|
|
|
10
|
my $running_test = $tab_builder->{running}; |
109
|
4
|
100
|
66
|
|
|
46
|
die $skip if defined $running_test && $running_test eq $callpack; |
110
|
2
|
|
|
|
|
6
|
return; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
33
|
|
|
|
|
57
|
my $callpack = caller(1); |
114
|
33
|
100
|
100
|
|
|
155
|
if ( 'tests' eq ( $_[1] || '' ) ) { |
115
|
12
|
|
|
|
|
34
|
$tab_builder->{plan_for}{$callpack} = $_[2]; |
116
|
12
|
50
|
|
|
|
42
|
if ( $tab_builder->{test_nowarnings_loaded}{$callpack} ) |
117
|
|
|
|
|
|
|
{ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
# Test::NoWarnings was loaded before plan() was called, so it |
120
|
|
|
|
|
|
|
# didn't have a change to decrement it |
121
|
0
|
|
|
|
|
0
|
$tab_builder->{plan_for}{$callpack}--; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
} |
124
|
33
|
|
|
|
|
116
|
$plan->(@_); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
{ |
129
|
|
|
|
|
|
|
my $ok; |
130
|
7
|
|
|
7
|
|
1915
|
BEGIN { $ok = \&Test::Builder::ok } |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my %FORBIDDEN = map { $_ => 1 } qw/BEGIN CHECK INIT END/; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub Test::Builder::ok { |
135
|
38
|
|
|
38
|
1
|
15794
|
__check_test_count(@_); |
136
|
38
|
|
|
|
|
68
|
my $level = 1; |
137
|
38
|
|
|
|
|
56
|
while (1) { |
138
|
132
|
|
100
|
|
|
1450
|
my ($caller) = ( ( ( caller($level) )[3] || '' ) =~ /::([[:word:]]+)\z/ ); |
139
|
132
|
100
|
|
|
|
492
|
last unless $caller; |
140
|
94
|
50
|
33
|
|
|
348
|
if ( $FORBIDDEN{$caller} |
141
|
|
|
|
|
|
|
&& not $_[0] |
142
|
|
|
|
|
|
|
->{'Test::Aggregate::Builder'}{ignore_timing_blocks} ) |
143
|
|
|
|
|
|
|
{ |
144
|
0
|
|
|
|
|
0
|
my ( $self, $test, $name ) = @_; |
145
|
0
|
0
|
|
|
|
0
|
$test = $test ? "Yes" : "No"; |
146
|
0
|
|
|
|
|
0
|
my ( $filename, $line ) = ( caller($level) )[ 1, 2 ]; |
147
|
0
|
|
|
|
|
0
|
$self->diag(<<" END"); |
148
|
|
|
|
|
|
|
>>>> DEPRECATION WARNING <<<< |
149
|
|
|
|
|
|
|
>>>> See http://use.perl.org/~Ovid/journal/38974 <<<< |
150
|
|
|
|
|
|
|
Aggregated tests should not be run in BEGIN, CHECK, INIT or END blocks. |
151
|
|
|
|
|
|
|
File: $filename |
152
|
|
|
|
|
|
|
Line: $line |
153
|
|
|
|
|
|
|
Name: $name |
154
|
|
|
|
|
|
|
Pass: $test |
155
|
|
|
|
|
|
|
END |
156
|
|
|
|
|
|
|
} |
157
|
94
|
|
|
|
|
181
|
$level++; |
158
|
|
|
|
|
|
|
} |
159
|
38
|
|
|
|
|
88
|
local $Test::Builder::Level = $Test::Builder::Level + 1; |
160
|
38
|
|
|
|
|
200
|
$ok->(@_); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
{ |
165
|
|
|
|
|
|
|
my $reset; |
166
|
7
|
|
|
7
|
|
550
|
BEGIN { $reset = \&Test::Builder::reset } |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub Test::Builder::reset { |
169
|
6
|
|
|
6
|
1
|
559
|
my $self = shift; |
170
|
6
|
|
|
|
|
20
|
$reset->($self); |
171
|
6
|
|
|
|
|
1638
|
$self->{'Test::Aggregate::Builder'} = { |
172
|
|
|
|
|
|
|
plan_for => {}, |
173
|
|
|
|
|
|
|
tests_run => {}, |
174
|
|
|
|
|
|
|
file_for => {}, |
175
|
|
|
|
|
|
|
test_nowarnings_loaded => {}, |
176
|
|
|
|
|
|
|
skip_all => {}, |
177
|
|
|
|
|
|
|
check_plan => undef, |
178
|
|
|
|
|
|
|
last_test => undef, |
179
|
|
|
|
|
|
|
}; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
{ |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
# Called in _ending and prevents the 'you tried to run a test without a |
186
|
|
|
|
|
|
|
# plan' error. |
187
|
|
|
|
|
|
|
my $_sanity_check; |
188
|
7
|
|
|
7
|
|
409
|
BEGIN { $_sanity_check = \&Test::Builder::_sanity_check } |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub Test::Builder::_sanity_check { |
191
|
0
|
|
|
0
|
|
0
|
$_[0]->{Have_Plan} = 1; |
192
|
0
|
|
|
|
|
0
|
$_sanity_check->(@_); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
} |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
{ |
197
|
|
|
|
|
|
|
my $skip; |
198
|
7
|
|
|
7
|
|
1200
|
BEGIN { $skip = \&Test::Builder::skip } |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub Test::Builder::skip { |
201
|
8
|
|
|
8
|
1
|
636
|
__check_test_count(@_); |
202
|
8
|
|
|
|
|
32
|
$skip->(@_); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
# two purposes: we check the test cout for a package, but we also return the |
207
|
|
|
|
|
|
|
# package name |
208
|
|
|
|
|
|
|
sub __check_test_count { |
209
|
48
|
|
|
48
|
|
115
|
my $self = shift; |
210
|
48
|
|
|
|
|
85
|
my $callpack; |
211
|
48
|
50
|
|
|
|
258
|
return unless $self->{'Test::Aggregate::Builder'}{check_plan}; |
212
|
0
|
|
|
|
|
|
my $stack_level = 1; |
213
|
0
|
|
|
|
|
|
while ( my ( $package, undef, undef, $subroutine ) = caller($stack_level) ) { |
214
|
0
|
0
|
|
|
|
|
last if 'Test::Aggregate' eq $package; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# XXX Because these blocks aren't really subroutines, caller() |
217
|
|
|
|
|
|
|
# doesn't report what you expect. |
218
|
|
|
|
|
|
|
last |
219
|
0
|
0
|
0
|
|
|
|
if $callpack && $subroutine =~ /::(?:BEGIN|END)\z/; |
220
|
0
|
|
|
|
|
|
$callpack = $package; |
221
|
0
|
|
|
|
|
|
$stack_level++; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
{ |
224
|
7
|
|
|
7
|
|
33
|
no warnings 'uninitialized'; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
527
|
|
|
0
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
$self->{'Test::Aggregate::Builder'}{tests_run}{$callpack} += 1; |
226
|
|
|
|
|
|
|
} |
227
|
0
|
|
|
|
|
|
return $callpack; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 AUTHOR |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Curtis Poe, C<< <ovid at cpan.org> >> |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head1 BUGS |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
237
|
|
|
|
|
|
|
C<bug-test-aggregate at rt.cpan.org>, or through the web interface at |
238
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Aggregate>. |
239
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
240
|
|
|
|
|
|
|
your bug as I make changes. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 SUPPORT |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
perldoc Test::Aggregate::Builder |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
You can also find information oneline: |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
L<http://metacpan.org/release/Test-Aggregate> |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Copyright 2007 Curtis "Ovid" Poe, all rights reserved. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
257
|
|
|
|
|
|
|
under the same terms as Perl itself. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=cut |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
1; |