line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Hub::Subtest; |
2
|
246
|
|
|
246
|
|
2062
|
use strict; |
|
246
|
|
|
|
|
516
|
|
|
246
|
|
|
|
|
7359
|
|
3
|
246
|
|
|
246
|
|
1261
|
use warnings; |
|
246
|
|
|
|
|
469
|
|
|
246
|
|
|
|
|
14239
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302182'; |
6
|
|
|
|
|
|
|
|
7
|
246
|
|
|
246
|
|
1641
|
BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } |
|
246
|
|
|
|
|
11541
|
|
8
|
246
|
|
|
246
|
|
1711
|
use Test2::Util::HashBase qw/nested exit_code manual_skip_all/; |
|
246
|
|
|
|
|
607
|
|
|
246
|
|
|
|
|
1812
|
|
9
|
246
|
|
|
246
|
|
1791
|
use Test2::Util qw/get_tid/; |
|
246
|
|
|
|
|
625
|
|
|
246
|
|
|
|
|
31909
|
|
10
|
|
|
|
|
|
|
|
11
|
105
|
|
|
105
|
0
|
495
|
sub is_subtest { 1 } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub inherit { |
14
|
273
|
|
|
273
|
0
|
520
|
my $self = shift; |
15
|
273
|
|
|
|
|
585
|
my ($from) = @_; |
16
|
|
|
|
|
|
|
|
17
|
273
|
|
|
|
|
1286
|
$self->SUPER::inherit($from); |
18
|
|
|
|
|
|
|
|
19
|
273
|
|
|
|
|
915
|
$self->{+NESTED} = $from->nested + 1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
# Legacy |
24
|
246
|
|
|
246
|
|
1860
|
no warnings 'once'; |
|
246
|
|
|
|
|
537
|
|
|
246
|
|
|
|
|
45666
|
|
25
|
|
|
|
|
|
|
*ID = \&Test2::Hub::HID; |
26
|
|
|
|
|
|
|
*id = \&Test2::Hub::hid; |
27
|
|
|
|
|
|
|
*set_id = \&Test2::Hub::set_hid; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub send { |
31
|
1434
|
|
|
1434
|
1
|
2427
|
my $self = shift; |
32
|
1434
|
|
|
|
|
2574
|
my ($e) = @_; |
33
|
|
|
|
|
|
|
|
34
|
1434
|
|
|
|
|
4959
|
my $out = $self->SUPER::send($e); |
35
|
|
|
|
|
|
|
|
36
|
1426
|
100
|
|
|
|
3411
|
return $out if $self->{+MANUAL_SKIP_ALL}; |
37
|
|
|
|
|
|
|
|
38
|
1425
|
|
|
|
|
4004
|
my $f = $e->facet_data; |
39
|
|
|
|
|
|
|
|
40
|
1425
|
100
|
|
|
|
7305
|
my $plan = $f->{plan} or return $out; |
41
|
252
|
50
|
|
|
|
1772
|
return $out unless $plan->{skip}; |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
0
|
my $trace = $f->{trace} or die "Missing Trace!"; |
44
|
|
|
|
|
|
|
return $out unless $trace->{pid} != $self->pid |
45
|
0
|
0
|
0
|
|
|
0
|
|| $trace->{tid} != $self->tid; |
46
|
|
|
|
|
|
|
|
47
|
246
|
|
|
246
|
|
2258
|
no warnings 'exiting'; |
|
246
|
|
|
|
|
569
|
|
|
246
|
|
|
|
|
40595
|
|
48
|
0
|
|
|
|
|
0
|
last T2_SUBTEST_WRAPPER; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub terminate { |
52
|
11
|
|
|
11
|
0
|
38
|
my $self = shift; |
53
|
11
|
|
|
|
|
30
|
my ($code, $e, $f) = @_; |
54
|
11
|
|
|
|
|
38
|
$self->set_exit_code($code); |
55
|
|
|
|
|
|
|
|
56
|
11
|
100
|
|
|
|
34
|
return if $self->{+MANUAL_SKIP_ALL}; |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
66
|
|
|
32
|
$f ||= $e->facet_data; |
59
|
|
|
|
|
|
|
|
60
|
9
|
100
|
|
|
|
25
|
if(my $plan = $f->{plan}) { |
61
|
5
|
50
|
|
|
|
27
|
my $trace = $f->{trace} or die "Missing Trace!"; |
62
|
|
|
|
|
|
|
return if $plan->{skip} |
63
|
5
|
50
|
33
|
|
|
66
|
&& ($trace->{pid} != $$ || $trace->{tid} != get_tid); |
|
|
|
33
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
246
|
|
|
246
|
|
1896
|
no warnings 'exiting'; |
|
246
|
|
|
|
|
610
|
|
|
246
|
|
|
|
|
18250
|
|
67
|
9
|
|
|
|
|
114
|
last T2_SUBTEST_WRAPPER; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Test2::Hub::Subtest - Hub used by subtests |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Subtests make use of this hub to route events. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 TOGGLES |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=over 4 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item $bool = $hub->manual_skip_all |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item $hub->set_manual_skip_all($bool) |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
The default is false. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Normally a skip-all plan event will cause a subtest to stop executing. This is |
97
|
|
|
|
|
|
|
accomplished via C<last LABEL> to a label inside the subtest code. Most of the |
98
|
|
|
|
|
|
|
time this is perfectly fine. There are times however where this flow control |
99
|
|
|
|
|
|
|
causes bad things to happen. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This toggle lets you turn off the abort logic for the hub. When this is toggled |
102
|
|
|
|
|
|
|
to true B<you> are responsible for ensuring no additional events are generated. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=back |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 SOURCE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The source code repository for Test2 can be found at |
109
|
|
|
|
|
|
|
F<http://github.com/Test-More/test-more/>. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 MAINTAINERS |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHORS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=over 4 |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
132
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
See F<http://dev.perl.org/licenses/> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |