line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Event::Subtest; |
2
|
246
|
|
|
246
|
|
2091
|
use strict; |
|
246
|
|
|
|
|
532
|
|
|
246
|
|
|
|
|
7301
|
|
3
|
246
|
|
|
246
|
|
1303
|
use warnings; |
|
246
|
|
|
|
|
485
|
|
|
246
|
|
|
|
|
14009
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302182'; |
6
|
|
|
|
|
|
|
|
7
|
246
|
|
|
246
|
|
1548
|
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } |
|
246
|
|
|
|
|
11165
|
|
8
|
246
|
|
|
246
|
|
1701
|
use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid}; |
|
246
|
|
|
|
|
577
|
|
|
246
|
|
|
|
|
1836
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
121
|
|
|
121
|
0
|
248
|
my $self = shift; |
12
|
121
|
|
|
|
|
729
|
$self->SUPER::init(); |
13
|
121
|
|
100
|
|
|
384
|
$self->{+SUBEVENTS} ||= []; |
14
|
121
|
100
|
|
|
|
384
|
if ($self->{+EFFECTIVE_PASS}) { |
15
|
109
|
|
|
|
|
200
|
$_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; |
|
810
|
|
|
|
|
2433
|
|
|
109
|
|
|
|
|
309
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
246
|
|
|
246
|
|
1981
|
no warnings 'redefine'; |
|
246
|
|
|
|
|
615
|
|
|
246
|
|
|
|
|
147228
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub set_subevents { |
23
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
24
|
0
|
|
|
|
|
0
|
my @subevents = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
0
|
if ($self->{+EFFECTIVE_PASS}) { |
27
|
0
|
|
|
|
|
0
|
$_->set_effective_pass(1) for grep { $_->can('effective_pass') } @subevents; |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
$self->{+SUBEVENTS} = \@subevents; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub set_effective_pass { |
34
|
69
|
|
|
69
|
0
|
114
|
my $self = shift; |
35
|
69
|
|
|
|
|
122
|
my ($pass) = @_; |
36
|
|
|
|
|
|
|
|
37
|
69
|
50
|
0
|
|
|
161
|
if ($pass) { |
|
|
0
|
|
|
|
|
|
38
|
69
|
|
|
|
|
127
|
$_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; |
|
452
|
|
|
|
|
1155
|
|
|
69
|
|
|
|
|
152
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
elsif ($self->{+EFFECTIVE_PASS} && !$pass) { |
41
|
0
|
|
|
|
|
0
|
for my $s (grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}) { |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
42
|
0
|
0
|
0
|
|
|
0
|
$_->set_effective_pass(0) unless $s->can('todo') && defined $s->todo; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
69
|
|
|
|
|
158
|
$self->{+EFFECTIVE_PASS} = $pass; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub summary { |
51
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
100
|
|
|
15
|
my $name = $self->{+NAME} || "Nameless Subtest"; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
9
|
my $todo = $self->{+TODO}; |
56
|
4
|
100
|
|
|
|
10
|
if ($todo) { |
|
|
100
|
|
|
|
|
|
57
|
1
|
|
|
|
|
4
|
$name .= " (TODO: $todo)"; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif (defined $todo) { |
60
|
1
|
|
|
|
|
4
|
$name .= " (TODO)"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
4
|
|
|
|
|
20
|
return $name; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub facet_data { |
67
|
258
|
|
|
258
|
1
|
485
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
258
|
|
|
|
|
1108
|
my $out = $self->SUPER::facet_data(); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$out->{parent} = { |
72
|
|
|
|
|
|
|
hid => $self->subtest_id, |
73
|
1571
|
|
|
|
|
3777
|
children => [map {$_->facet_data} @{$self->{+SUBEVENTS}}], |
|
258
|
|
|
|
|
764
|
|
74
|
258
|
|
|
|
|
1207
|
buffered => $self->{+BUFFERED}, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
258
|
|
|
|
|
1043
|
return $out; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub add_amnesty { |
81
|
15
|
|
|
15
|
1
|
31
|
my $self = shift; |
82
|
|
|
|
|
|
|
|
83
|
15
|
|
|
|
|
50
|
for my $am (@_) { |
84
|
15
|
50
|
|
|
|
117
|
$am = {%$am} if ref($am) ne 'ARRAY'; |
85
|
15
|
|
|
|
|
64
|
$am = Test2::EventFacet::Amnesty->new($am); |
86
|
|
|
|
|
|
|
|
87
|
15
|
|
|
|
|
43
|
push @{$self->{+AMNESTY}} => $am; |
|
15
|
|
|
|
|
64
|
|
88
|
|
|
|
|
|
|
|
89
|
15
|
|
|
|
|
29
|
for my $e (@{$self->{+SUBEVENTS}}) { |
|
15
|
|
|
|
|
85
|
|
90
|
96
|
|
|
|
|
292
|
$e->add_amnesty($am->clone(inherited => 1)); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=pod |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=encoding UTF-8 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 NAME |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Test2::Event::Subtest - Event for subtest types |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 DESCRIPTION |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This class represents a subtest. This class is a subclass of |
111
|
|
|
|
|
|
|
L<Test2::Event::Ok>. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 ACCESSORS |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This class inherits from L<Test2::Event::Ok>. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over 4 |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item $arrayref = $e->subevents |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns the arrayref containing all the events from the subtest |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item $bool = $e->buffered |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
True if the subtest is buffered, that is all subevents render at once. If this |
126
|
|
|
|
|
|
|
is false it means all subevents render as they are produced. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SOURCE |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The source code repository for Test2 can be found at |
133
|
|
|
|
|
|
|
F<http://github.com/Test-More/test-more/>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 MAINTAINERS |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=over 4 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=back |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 AUTHORS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=over 4 |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item Chad Granum E<lt>exodist@cpan.orgE<gt> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=back |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 COPYRIGHT |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Copyright 2020 Chad Granum E<lt>exodist@cpan.orgE<gt>. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
156
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
See F<http://dev.perl.org/licenses/> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |