line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Event::Subtest; |
2
|
246
|
|
|
246
|
|
2116
|
use strict; |
|
246
|
|
|
|
|
511
|
|
|
246
|
|
|
|
|
7228
|
|
3
|
246
|
|
|
246
|
|
1344
|
use warnings; |
|
246
|
|
|
|
|
556
|
|
|
246
|
|
|
|
|
13664
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.302181'; |
6
|
|
|
|
|
|
|
|
7
|
246
|
|
|
246
|
|
1575
|
BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) } |
|
246
|
|
|
|
|
11066
|
|
8
|
246
|
|
|
246
|
|
1714
|
use Test2::Util::HashBase qw{subevents buffered subtest_id subtest_uuid}; |
|
246
|
|
|
|
|
633
|
|
|
246
|
|
|
|
|
1767
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
121
|
|
|
121
|
0
|
274
|
my $self = shift; |
12
|
121
|
|
|
|
|
655
|
$self->SUPER::init(); |
13
|
121
|
|
100
|
|
|
368
|
$self->{+SUBEVENTS} ||= []; |
14
|
121
|
100
|
|
|
|
363
|
if ($self->{+EFFECTIVE_PASS}) { |
15
|
109
|
|
|
|
|
204
|
$_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; |
|
810
|
|
|
|
|
2359
|
|
|
109
|
|
|
|
|
313
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
{ |
20
|
246
|
|
|
246
|
|
2037
|
no warnings 'redefine'; |
|
246
|
|
|
|
|
608
|
|
|
246
|
|
|
|
|
145085
|
|
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
|
122
|
my $self = shift; |
35
|
69
|
|
|
|
|
139
|
my ($pass) = @_; |
36
|
|
|
|
|
|
|
|
37
|
69
|
50
|
0
|
|
|
144
|
if ($pass) { |
|
|
0
|
|
|
|
|
|
38
|
69
|
|
|
|
|
100
|
$_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}; |
|
452
|
|
|
|
|
1128
|
|
|
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
|
10
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
100
|
|
|
17
|
my $name = $self->{+NAME} || "Nameless Subtest"; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
8
|
my $todo = $self->{+TODO}; |
56
|
4
|
100
|
|
|
|
14
|
if ($todo) { |
|
|
100
|
|
|
|
|
|
57
|
1
|
|
|
|
|
5
|
$name .= " (TODO: $todo)"; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif (defined $todo) { |
60
|
1
|
|
|
|
|
4
|
$name .= " (TODO)"; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
4
|
|
|
|
|
19
|
return $name; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub facet_data { |
67
|
258
|
|
|
258
|
1
|
472
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
258
|
|
|
|
|
997
|
my $out = $self->SUPER::facet_data(); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$out->{parent} = { |
72
|
|
|
|
|
|
|
hid => $self->subtest_id, |
73
|
1571
|
|
|
|
|
3761
|
children => [map {$_->facet_data} @{$self->{+SUBEVENTS}}], |
|
258
|
|
|
|
|
817
|
|
74
|
258
|
|
|
|
|
1198
|
buffered => $self->{+BUFFERED}, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
258
|
|
|
|
|
1055
|
return $out; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub add_amnesty { |
81
|
15
|
|
|
15
|
1
|
43
|
my $self = shift; |
82
|
|
|
|
|
|
|
|
83
|
15
|
|
|
|
|
42
|
for my $am (@_) { |
84
|
15
|
50
|
|
|
|
124
|
$am = {%$am} if ref($am) ne 'ARRAY'; |
85
|
15
|
|
|
|
|
73
|
$am = Test2::EventFacet::Amnesty->new($am); |
86
|
|
|
|
|
|
|
|
87
|
15
|
|
|
|
|
33
|
push @{$self->{+AMNESTY}} => $am; |
|
15
|
|
|
|
|
70
|
|
88
|
|
|
|
|
|
|
|
89
|
15
|
|
|
|
|
33
|
for my $e (@{$self->{+SUBEVENTS}}) { |
|
15
|
|
|
|
|
46
|
|
90
|
96
|
|
|
|
|
254
|
$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 |