line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Hub::Subtest; |
2
|
246
|
|
|
246
|
|
2031
|
use strict; |
|
246
|
|
|
|
|
548
|
|
|
246
|
|
|
|
|
7251
|
|
3
|
246
|
|
|
246
|
|
1269
|
use warnings; |
|
246
|
|
|
|
|
489
|
|
|
246
|
|
|
|
|
14146
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302181'; |
6
|
|
|
|
|
|
|
|
7
|
246
|
|
|
246
|
|
1520
|
BEGIN { require Test2::Hub; our @ISA = qw(Test2::Hub) } |
|
246
|
|
|
|
|
11769
|
|
8
|
246
|
|
|
246
|
|
1689
|
use Test2::Util::HashBase qw/nested exit_code manual_skip_all/; |
|
246
|
|
|
|
|
593
|
|
|
246
|
|
|
|
|
1841
|
|
9
|
246
|
|
|
246
|
|
1775
|
use Test2::Util qw/get_tid/; |
|
246
|
|
|
|
|
533
|
|
|
246
|
|
|
|
|
31255
|
|
10
|
|
|
|
|
|
|
|
11
|
105
|
|
|
105
|
0
|
490
|
sub is_subtest { 1 } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub inherit { |
14
|
273
|
|
|
273
|
0
|
530
|
my $self = shift; |
15
|
273
|
|
|
|
|
605
|
my ($from) = @_; |
16
|
|
|
|
|
|
|
|
17
|
273
|
|
|
|
|
1265
|
$self->SUPER::inherit($from); |
18
|
|
|
|
|
|
|
|
19
|
273
|
|
|
|
|
931
|
$self->{+NESTED} = $from->nested + 1; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
# Legacy |
24
|
246
|
|
|
246
|
|
1927
|
no warnings 'once'; |
|
246
|
|
|
|
|
509
|
|
|
246
|
|
|
|
|
45670
|
|
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
|
2455
|
my $self = shift; |
32
|
1434
|
|
|
|
|
2636
|
my ($e) = @_; |
33
|
|
|
|
|
|
|
|
34
|
1434
|
|
|
|
|
5038
|
my $out = $self->SUPER::send($e); |
35
|
|
|
|
|
|
|
|
36
|
1426
|
100
|
|
|
|
3358
|
return $out if $self->{+MANUAL_SKIP_ALL}; |
37
|
|
|
|
|
|
|
|
38
|
1425
|
|
|
|
|
3916
|
my $f = $e->facet_data; |
39
|
|
|
|
|
|
|
|
40
|
1425
|
100
|
|
|
|
7343
|
my $plan = $f->{plan} or return $out; |
41
|
252
|
50
|
|
|
|
1476
|
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
|
|
1865
|
no warnings 'exiting'; |
|
246
|
|
|
|
|
588
|
|
|
246
|
|
|
|
|
40530
|
|
48
|
0
|
|
|
|
|
0
|
last T2_SUBTEST_WRAPPER; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub terminate { |
52
|
11
|
|
|
11
|
0
|
39
|
my $self = shift; |
53
|
11
|
|
|
|
|
26
|
my ($code, $e, $f) = @_; |
54
|
11
|
|
|
|
|
42
|
$self->set_exit_code($code); |
55
|
|
|
|
|
|
|
|
56
|
11
|
100
|
|
|
|
32
|
return if $self->{+MANUAL_SKIP_ALL}; |
57
|
|
|
|
|
|
|
|
58
|
9
|
|
66
|
|
|
26
|
$f ||= $e->facet_data; |
59
|
|
|
|
|
|
|
|
60
|
9
|
100
|
|
|
|
30
|
if(my $plan = $f->{plan}) { |
61
|
5
|
50
|
|
|
|
26
|
my $trace = $f->{trace} or die "Missing Trace!"; |
62
|
|
|
|
|
|
|
return if $plan->{skip} |
63
|
5
|
50
|
33
|
|
|
51
|
&& ($trace->{pid} != $$ || $trace->{tid} != get_tid); |
|
|
|
33
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
246
|
|
|
246
|
|
1869
|
no warnings 'exiting'; |
|
246
|
|
|
|
|
559
|
|
|
246
|
|
|
|
|
17988
|
|
67
|
9
|
|
|
|
|
105
|
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 |