blib/lib/TAP/Formatter/Session/TeamCity.pm

filter: Statementstmt 89.8% 195 / 217 Branchbran 80.6% 71 / 88 Conditioncond 60.8% 14 / 23 MC/DCmcdc 40.0% 6 / 15 Subroutinesub 100% 25 / 25 Podpod 100% 2 / 2 totaltotal 84.5% 313 / 370 CC 55 SCAR 26.2
CC
55
Cov
85%
_handle_unknown
41.2
close_test
7.0
_tc_message
5.1
CRAP 13.8
↑ Summary /usr/local/bin/prove »
1 package TAP::Formatter::Session::TeamCity;
2  
3 21 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 21 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 21 our $VERSION = '0.13';
7  
8 21 ▶use TAP::Parser::Result::Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 21 ▶use TeamCity::Message qw( tc_message );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 21 ▶use base qw( TAP::Formatter::Session );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 {
14 21 my @accessors = map { '_tc_' . $_ } qw(
15 last_test_name
16 last_test_result
17 last_suite_is_empty
18 suite_name_stack
19 test_output_buffer
20 suite_output_buffer
21 buffered_output
22 output_handle
23 );
24 21 __PACKAGE__->mk_methods(@accessors);
25 }
26  
27 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
28 52 ▶sub _initialize {
Subroutine _initialize: called CC=2 SCAR=6.9
29 52 my $self = shift;
30  
31 52 $self->SUPER::_initialize(@_);
32  
33 52 $self->_tc_suite_name_stack( [] );
34 52 $self->_tc_test_output_buffer(q{});
35 52 $self->_tc_suite_output_buffer(q{});
36  
37 52 my $buffered = q{};
38 52 $self->_tc_buffered_output( \$buffered );
39  
40 52 ▶ if ( $self->_is_parallel ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_parallel) { } 17 35 52
41 17 $self->_tc_message(
42 'progressMessage',
43 'starting ' . $self->name,
44 1,
45 );
46  
47 ## no critic (InputOutput::RequireCheckedOpen, InputOutput::RequireCheckedSyscalls)
48 17 open my $fh, '>', \$buffered;
49 17 $self->_tc_output_handle($fh);
50 }
51 else {
52 35 $self->_tc_output_handle( \*STDOUT );
53 }
54  
55 52 $self->_start_suite( $self->name );
56  
57 52 return $self;
58 }
59 ## use critic
60  
61 104 ▶sub _is_parallel {
Subroutine _is_parallel: called CC=1 SCAR=0.0
62 104 return $_[0]->formatter->jobs > 1;
63 }
64  
65 1133 ▶sub result {
Subroutine result: called CC=2 SCAR=7.0
Pod documented
66 1133 my $self = shift;
67 1133 my $result = shift;
68  
69 1133 my $type = $result->type;
70 1133 my $handler = "_handle_$type";
71  
72 1133 ▶ die qq{Can't handle result of type=$type}
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can($handler) 0 1133 1133
73 unless $self->can($handler);
74  
75 1133 $self->$handler($result);
76 }
77  
78 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
79 52 ▶sub _handle_test {
Subroutine _handle_test: called CC=4 SCAR=16.0
80 52 my $self = shift;
81 52 my $result = shift;
82  
83 52 ▶ unless ( $self->_test_finished ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_test_finished) 40 12 52
84 40 ▶ if ( $result->directive eq 'SKIP' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->directive eq "SKIP") 0 40 40
85  
86 # when tcm skips methods, we get 1st a Subtest message
87 # then "ok $num # skip $message"
88 0 ( my $reason ) = ( $result->raw =~ /^\s*ok [0-9]+ # skip (.*)$/ );
89  
90 0 $self->_tc_message(
91 'testStarted',
92 {
93 name => 'Skipped',
94 captureStandardOutput => 'true'
95 }
96 );
97 0 $self->_tc_message(
98 'testIgnored',
99 {
100 name => 'Skipped',
101 message => $reason
102 },
103 );
104 0 $self->_finish_test('Skipped');
105 0 $self->_finish_suite;
106 0 return;
107 }
108 }
109  
110 52 my $test_name = $self->_compute_test_name($result);
111  
112 52 ▶ $self->_test_started($result) unless $self->_finish_suite($test_name);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_finish_suite($test_name) 51 1 52
113 }
114  
115 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
116 66 ▶sub _handle_comment {
Subroutine _handle_comment: called CC=5 SCAR=16.1
117 66 my $self = shift;
118 66 my $result = shift;
119  
120 66 my $comment = $result->raw;
121  
122 # Always pass TC messages through immediately.
123 66 ▶ if ( $comment =~ /^##teamcity\[/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($comment =~ /^##teamcity\[/) 6 60 66
124 6 my $handle = $self->_tc_output_handle;
125 6 ▶ print STDOUT $comment, "\n" or die $!;
Branch: 1 branch
BranchTrueFalseTotal
print STDOUT $comment, "\n" or die $! 6 0 6
126 6 return;
127 }
128  
129 60 ▶ if ( $comment =~ /^\s*# Looks like you failed [0-9]+/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($comment =~ /^\s*# Looks like you failed [0-9]+/) 9 51 60
130 9 $self->_test_finished;
131 9 return;
132 }
133 51 $comment =~ s/^\s*#\s?//;
134 51 $comment =~ s/\s+$//;
135 51 ▶ return unless $comment =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $comment =~ /\S/ 0 51 51
136 51 $self->_append_to_tc_test_output_buffer("$comment\n");
137 }
138  
139 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines, Subroutines::ProhibitExcessComplexity)
140 #
141 # This method will be called for all subtest output. The default TAP formatter
142 # we're subclassing cannot parse subtests at all, and it basically ignores all
143 # lines with leading spaces, treating them as unknown content. We, however,
144 # need to parse that output in order to generate the relevant TC events.
145 975 ▶sub _handle_unknown {
Subroutine _handle_unknown: called CC=21 SCAR=37.2
146 975 my $self = shift;
147 975 my $result = shift;
148  
149 975 my $raw = $result->raw;
150  
151 # We are starting a new subtest. This is a note emitted by Test::Builder
152 # at the beginning of each subtest. It simply consists of "Subtest:
153 # $name".
154 975 ▶ if ( $raw =~ /^\s*# Subtest: (.*)$/ ) {
Branch: 8 branches
BranchTrueFalseTotal
if ($raw =~ /^\s*# Subtest: (.*)$/) { } 0 975 975
elsif ($raw =~ /^\s*(not )?ok ([0-9]+)( - (.*))?$/) { } 102 873 975
elsif ($raw =~ /^\s+ok [0-9]+ # skip (.*)$/ and not $self->_tc_last_test_result) { } 0 873 873
elsif ($raw =~ /^\s*# Looks like you failed [0-9]+/) { } 0 873 873
elsif ($raw =~ /^\s*#/) { } 36 837 873
elsif ($raw =~ qr/Deep recursion on subroutine "B::Deparse/) { } 0 837 837
elsif ($raw =~ /^\s+[0-9]+\.\.[0-9]+$/) { } 54 783 837
elsif ($raw =~ /\S/) { } 669 114 783
155 0 $self->_test_finished;
156 0 $self->_start_suite($1);
157  
158 # We want progress messages for each top-level subtest, but not for
159 # any subtests they might contain.
160 0 ▶ if ( $self->_is_parallel && @{ $self->_tc_suite_name_stack } == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_parallel and @{$self->_tc_suite_name_stack;} == 2) 0 0 0
Condition0%0/3
$self->_is_parallel and @{$self->_tc_suite_name_stack;} == 2
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_parallel and @{$self->_tc_suite_name_stack;} == 2
$self->_is_parallel @{$self->_tc_suite_name_stack;} == 2
Truth table0%0/3
A and B
A= $self->_is_parallelB= @{$self->_tc_suite_name_stack;} == 2
ABresult
0X0
100
111
161 0 my $name = join q{ - }, @{ $self->_tc_suite_name_stack };
162 0 $self->_tc_message(
163 'progressMessage',
164 "starting $name",
165 1,
166 );
167 }
168 }
169  
170 # This is a test result inside a subtest.
171 elsif ( $raw =~ /^\s*(not )?ok ([0-9]+)( - (.*))?$/ ) {
172 102 my $is_ok = !$1;
173 102 my $test_num = $2;
174 102 my $test_name = $4;
175 102 $self->_test_finished;
176 102 ▶ $test_name = 'NO TEST NAME' unless defined $test_name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $test_name 3 99 102
177  
178 102 my $todo;
179 102 ▶ if ( $test_name =~ s/ # TODO (.+)$// ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test_name =~ s/ # TODO (.+)$//) 6 96 102
180 6 $todo = $1;
181 }
182  
183 102 ▶ unless ( $self->_finish_suite($test_name) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_finish_suite($test_name)) 102 0 102
184 102 ▶ my $ok = $is_ok || $todo ? 'ok' : 'not ok';
Branch: 1 branch
BranchTrueFalseTotal
$is_ok || $todo ? : 90 12 102
Condition100%3/3
$is_ok or $todo
l!l&&r!l&&!r
87312
MC/DC100%2/2
$is_ok or $todo
$is_ok $todo
Truth table100%3/3
A or B
A= $is_okB= $todo
ABresult
1X1
011
000
185 102 ▶ my $actual_result = TAP::Parser::Result::Test->new(
Branch: 1 branch
BranchTrueFalseTotal
$todo ? : 6 96 102
Condition100%2/2
$todo // ""
l!l
696
MC/DC100%1/1
$todo // ""
$todo
Truth table100%2/2
A
A= $todo
Aresult
11
00
186 {
187 'ok' => $ok,
188 'explanation' => $todo // q{},
189 'directive' => $todo ? 'TODO' : q{},
190 'type' => 'test',
191 'test_num' => $test_num,
192 'description' => "- $test_name",
193 'raw' => "$ok $test_num - $test_name",
194 }
195 );
196 102 $self->_test_started($actual_result);
197 }
198 }
199  
200 # This is a skipped test.
201 ▶ elsif ( $raw =~ /^\s+ok [0-9]+ # skip (.*)$/
Condition33%1/3
$raw =~ /^\s+ok [0-9]+ # skip (.*)$/ and not $self->_tc_last_test_result
!ll&&!rl&&r
87300
MC/DC0%0/2
$raw =~ /^\s+ok [0-9]+ # skip (.*)$/ and not $self->_tc_last_test_result
$raw =~ /^\s+ok [0-9]+ # skip (.*)$/ not $self->_tc_last_test_result
Truth table33%1/3
A and not(B)
A= $raw =~ /^\s+ok [0-9]+ # skip (.*)$/B= not $self->_tc_last_test_result
ABresult
0X0
100
111
202 && !$self->_tc_last_test_result ) {
203  
204 # when tcm skips methods, we get 1st a Subtest message
205 # then "ok $num # skip $message"
206 0 my $reason = $1;
207 0 $self->_tc_message(
208 'testStarted',
209 {
210 name => 'Skipped',
211 captureStandardOutput => 'true'
212 },
213 );
214 0 $self->_tc_message(
215 'testIgnored',
216 {
217 name => 'Skipped',
218 message => $reason,
219 },
220 );
221 0 $self->_finish_test('Skipped');
222 0 $self->_finish_suite;
223 }
224  
225 # I'm not sure how this could ever happen, but it seems like it can under
226 # Test::Class::Moose. The "Looks like you failed ..." message should only
227 # happen when a process exits, not when a subtest finishes.
228 elsif ( $raw =~ /^\s*# Looks like you failed [0-9]+/ ) {
229 0 $self->_test_finished;
230 }
231  
232 # This is a note or diag inside the subtest.
233 elsif ( $raw =~ /^\s*#/ ) {
234 36 ( my $clean_raw = $raw ) =~ s/^\s*#\s?//;
235 36 $clean_raw =~ s/\s+$//;
236 36 ▶ return unless $clean_raw =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless $clean_raw =~ /\S/ 0 36 36
237  
238 # If we have a test in the buffer, then this diagnostic message
239 # applies to that test.
240 36 ▶ if ( $self->_tc_last_test_result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_tc_last_test_result) { } 36 0 36
241  
242 # I think this should actually be appended to the test output
243 # buffer, but that output can get eaten when a subtest dies. For
244 # now we'll just turn this into a generic TC message.
245 36 $self->_tc_message(
246 'message',
247 { text => $clean_raw },
248 );
249 }
250  
251 # Otherwise it applies to the most recent subtest (or the .t file
252 # itself).
253 else {
254 0 $self->_append_to_tc_suite_output_buffer("$clean_raw\n");
255 }
256 }
257  
258 # This is noise from Devel::Cover that we don't want to throw out
259 # entirely, but also should not affect the test status either.
260 elsif ( $raw =~ qr/Deep recursion on subroutine "B::Deparse/ ) {
261 0 $self->_tc_message(
262 'message',
263 { text => $raw },
264 );
265 }
266  
267 # This is a test count from TAP. We don't care about that.
268 elsif ( $raw =~ /^\s+[0-9]+\.\.[0-9]+$/ ) {
269 54 return;
270 }
271  
272 # Anything else might be random non-TAP output. We want to capture it and
273 # make sure it's emitted in the TC results if it is.
274 elsif ( $raw =~ /\S/ ) {
275 669 $self->_append_to_tc_suite_output_buffer($raw);
276 }
277 }
278  
279 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
280 40 ▶sub _handle_plan {
Subroutine _handle_plan: called CC=3 SCAR=11.0
281 40 my $self = shift;
282 40 my $result = shift;
283  
284 40 ▶ unless ( $self->_test_finished ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_test_finished) 19 21 40
285 19 ▶ if ( $result->directive eq 'SKIP' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->directive eq "SKIP") 3 16 19
286 3 $self->_tc_message(
287 'testStarted',
288 {
289 name => 'Skipped',
290 captureStandardOutput => 'true',
291 },
292 );
293 3 $self->_tc_message(
294 'testIgnored',
295 {
296 name => 'Skipped',
297 message => $result->explanation,
298 },
299 );
300 3 $self->_finish_test('Skipped');
301 }
302 }
303 }
304  
305 166 ▶sub _test_started {
Subroutine _test_started: called CC=1 SCAR=0.0
306 166 my $self = shift;
307 166 my $result = shift;
308  
309 166 my $test_name = $self->_compute_test_name($result);
310 166 $self->_tc_message(
311 'testStarted',
312 {
313 name => $test_name,
314 captureStandardOutput => 'true',
315 },
316 );
317 166 $self->_tc_last_test_name($test_name);
318 166 $self->_tc_last_test_result($result);
319 }
320  
321 268 ▶sub _test_finished {
Subroutine _test_finished: called CC=2 SCAR=6.9
322 268 my $self = shift;
323  
324 268 ▶ return unless $self->_tc_last_test_result;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_tc_last_test_result 102 166 268
325 166 $self->_emit_teamcity_test_results(
326 $self->_tc_last_test_name,
327 $self->_tc_last_test_result
328 );
329 166 $self->_finish_test( $self->_tc_last_test_name );
330 166 return 1;
331 }
332  
333 166 ▶sub _emit_teamcity_test_results {
Subroutine _emit_teamcity_test_results: called CC=5 SCAR=16.1
334 166 my $self = shift;
335 166 my $test_name = shift;
336 166 my $result = shift;
337  
338 166 my $buffer = $self->_tc_test_output_buffer;
339 166 $self->_tc_test_output_buffer(q{});
340 166 chomp $buffer;
341  
342 166 ▶ if ( $result->has_todo || $result->has_skip ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->has_todo or $result->has_skip) 6 160 166
Condition66%2/3
$result->has_todo or $result->has_skip
l!l&&r!l&&!r
60160
MC/DC50%1/2
$result->has_todo or $result->has_skip
$result->has_todo $result->has_skip
Truth table66%2/3
A or B
A= $result->has_todoB= $result->has_skip
ABresult
1X1
011
000
343 6 $self->_tc_message(
344 'testIgnored',
345 {
346 name => $test_name,
347 message => $result->explanation,
348 },
349 );
350 6 return;
351 }
352  
353 160 ▶ return if $result->is_ok;
Branch: 1 branch
BranchTrueFalseTotal
if $result->is_ok 123 37 160
354  
355 37 ▶ $self->_tc_message(
Branch: 1 branch
BranchTrueFalseTotal
$buffer ? : 21 16 37
356 'testFailed',
357 {
358 name => $test_name,
359 message => 'not ok',
360 ( $buffer ? ( details => $buffer ) : () ),
361 },
362 );
363 }
364  
365 218 ▶sub _compute_test_name {
Subroutine _compute_test_name: called CC=3 SCAR=11.0
366 218 my $self = shift;
367 218 my $result = shift;
368  
369 218 my $description = $result->description;
370 218 ▶ my $test_name = $description eq q{} ? $result->explanation : $description;
Branch: 1 branch
BranchTrueFalseTotal
$description eq '' ? : 6 212 218
371 218 $test_name =~ s/^-\s//;
372 218 ▶ $test_name = 'NO TEST NAME' if $test_name eq q{};
Branch: 1 branch
BranchTrueFalseTotal
if $test_name eq "" 6 212 218
373 218 return $test_name;
374 }
375  
376 169 ▶sub _finish_test {
Subroutine _finish_test: called CC=1 SCAR=0.0
377 169 my $self = shift;
378 169 my $test_name = shift;
379  
380 169 $self->_tc_message( 'testFinished', { name => $test_name } );
381 169 $self->_tc_last_test_name(undef);
382 169 $self->_tc_last_test_result(undef);
383 169 $self->_tc_last_suite_is_empty(0);
384 }
385  
386 52 ▶sub _start_suite {
Subroutine _start_suite: called CC=1 SCAR=0.0
387 52 my $self = shift;
388 52 my $suite_name = shift;
389  
390 52 push @{ $self->_tc_suite_name_stack }, $suite_name;
391 52 $self->_tc_last_suite_is_empty(1);
392 52 $self->_tc_message( 'testSuiteStarted', { name => $suite_name } );
393 }
394  
395 52 ▶sub close_test {
Subroutine close_test: called CC=7 SCAR=19.5
Pod documented
396 52 my $self = shift;
397  
398 52 ▶ if ( $self->_tc_test_output_buffer
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_tc_test_output_buffer =~ /^Tests\ were\ run\ but\ no\ plan\ was\ declared\ and\ done_testing\(\)\ was\ not\ seen\.$/m) { } 3 49 52
399 =~ /^\QTests were run but no plan was declared and done_testing() was not seen.\E$/m
400 ) {
401 3 $self->_recover_from_catastrophic_death;
402 }
403 else {
404 49 ▶ if ( !$self->_test_finished && $self->_tc_suite_output_buffer ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_test_finished and $self->_tc_suite_output_buffer) 9 40 49
Condition100%3/3
not $self->_test_finished and $self->_tc_suite_output_buffer
!ll&&!rl&&r
12289
MC/DC100%2/2
not $self->_test_finished and $self->_tc_suite_output_buffer
not $self->_test_finished $self->_tc_suite_output_buffer
Truth table100%3/3
not(A) and B
A= not $self->_test_finishedB= $self->_tc_suite_output_buffer
ABresult
0X0
100
111
405 9 $self->_test_started( $self->_test_died_result_object );
406 9 $self->_tc_test_output_buffer( $self->_tc_suite_output_buffer );
407 9 $self->_tc_suite_output_buffer(q{});
408 9 $self->_test_finished;
409 }
410 {
411 49 my @copy = @{ $self->_tc_suite_name_stack };
412 49 $self->_finish_suite for @copy;
413 }
414 }
415  
416 52 ▶ if ( $self->_is_parallel ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_parallel) 17 35 52
417 17 ▶ print ${ $self->_tc_buffered_output }
Branch: 1 branch
BranchTrueFalseTotal
print ${$self->_tc_buffered_output;} or die $! 17 0 17
418 or die $!;
419 }
420 }
421  
422 3 ▶sub _recover_from_catastrophic_death {
Subroutine _recover_from_catastrophic_death: called CC=3 SCAR=11.1
423 3 my $self = shift;
424  
425 3 ▶ if ( $self->_tc_last_test_result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_tc_last_test_result) { } 3 0 3
426 3 my $test_num = $self->_tc_last_test_result->number;
427 3 my $description = $self->_tc_last_test_result->description;
428 3 $self->_tc_last_test_result(
429 TAP::Parser::Result::Test->new(
430 {
431 'ok' => 'not ok',
432 'explanation' => q{},
433 'directive' => q{},
434 'type' => 'test',
435 'test_num' => $test_num,
436 'description' => "- $description",
437 'raw' => "not ok $test_num - $description",
438 }
439 )
440 );
441 }
442 else {
443 0 $self->_test_started( $self->_test_died_result_object );
444 }
445 3 $self->_test_finished;
446 {
447 3 my @copy = @{ $self->_tc_suite_name_stack };
448 3 $self->_finish_suite for @copy;
449 }
450 }
451  
452 205 ▶sub _finish_suite {
Subroutine _finish_suite: called CC=5 SCAR=16.1
453 205 my $self = shift;
454 205 my $name = shift;
455  
456 205 ▶ return 0 unless @{ $self->_tc_suite_name_stack };
Branch: 1 branch
BranchTrueFalseTotal
unless @{$self->_tc_suite_name_stack;} 0 205 205
457  
458 205 ▶ $name //= $self->_tc_suite_name_stack->[-1];
Condition66%2/3
$name //= $self->_tc_suite_name_stack->[-1]
l!l&&r!l&&!r
154510
MC/DC0%0/2
$name //= $self->_tc_suite_name_stack->[-1]
$name $self->_tc_suite_name_stack->[-1]
Truth table66%2/3
A //= B
A= $nameB= $self->_tc_suite_name_stack->[-1]
ABresult
1X1
011
000
459  
460 205 ▶ return 0 unless $name eq $self->_tc_suite_name_stack->[-1];
Branch: 1 branch
BranchTrueFalseTotal
unless $name eq $self->_tc_suite_name_stack->[-1] 153 52 205
461  
462 52 ▶ if ( $self->_tc_last_suite_is_empty ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_tc_last_suite_is_empty) 4 48 52
463 4 $self->_test_started( $self->_test_died_result_object );
464 4 $self->_tc_test_output_buffer( $self->_tc_suite_output_buffer );
465 4 $self->_tc_suite_output_buffer(q{});
466 4 $self->_test_finished;
467 }
468 52 pop @{ $self->_tc_suite_name_stack };
469 52 $self->_tc_suite_output_buffer(q{});
470 52 $self->_tc_last_suite_is_empty(0);
471 52 $self->_tc_message( 'testSuiteFinished', { name => $name } );
472  
473 52 return 1;
474 }
475  
476 51 ▶sub _append_to_tc_test_output_buffer {
Subroutine _append_to_tc_test_output_buffer: called CC=1 SCAR=0.0
477 51 my $self = shift;
478 51 my $output = shift;
479  
480 51 $self->_tc_test_output_buffer( $self->_tc_test_output_buffer . $output );
481  
482 51 return;
483 }
484  
485 669 ▶sub _append_to_tc_suite_output_buffer {
Subroutine _append_to_tc_suite_output_buffer: called CC=1 SCAR=0.0
486 669 my $self = shift;
487 669 my $output = shift;
488  
489 669 $self->_tc_suite_output_buffer(
490 $self->_tc_suite_output_buffer . $output );
491  
492 669 return;
493 }
494  
495 13 ▶sub _test_died_result_object {
Subroutine _test_died_result_object: called CC=1 SCAR=0.0
496  
497 # We used to try to figure out whether we died in a subtest or the top
498 # level test for the .t file by looking at the size of the test suite
499 # stack, but there's really no reliable way to figure that out with the
500 # information we have available. That means we just have to use this
501 # fairly generic test name instead of something like 'Test died in a
502 # subtest'.
503 13 my $test_name = 'Test died';
504 13 return TAP::Parser::Result::Test->new(
505 {
506 'ok' => 'not ok',
507 'explanation' => q{},
508 'directive' => q{},
509 'type' => 'test',
510 'test_num' => 1,
511 'description' => "- $test_name",
512 'raw' => "not ok 1 - $test_name",
513 }
514 );
515 }
516  
517 541 ▶sub _tc_message {
Subroutine _tc_message: called CC=5 SCAR=16.3
518 541 my $self = shift;
519 541 my $type = shift;
520 541 my $content = shift;
521 541 my $force_stdout = shift;
522  
523 541 ▶ if ( ref $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $content) 524 17 541
524 524 ▶ $content->{flowId} ||= $self->name;
Condition33%1/3
$content->{"flowId"} ||= $self->name
l!l&&r!l&&!r
05240
MC/DC0%0/2
$content->{"flowId"} ||= $self->name
$content->{"flowId"} $self->name
Truth table33%1/3
A ||= B
A= $content->{"flowId"}B= $self->name
ABresult
1X1
011
000
525 }
526  
527 541 ▶ my $handle = $force_stdout ? \*STDOUT : $self->_tc_output_handle;
Branch: 1 branch
BranchTrueFalseTotal
$force_stdout ? : 17 524 541
528 541 ▶ print {$handle} tc_message(
Branch: 1 branch
BranchTrueFalseTotal
print {$handle;} tc_message("type", $type, "content", $content) or die $! 541 0 541
529 type => $type,
530 content => $content,
531 ) or die $!;
532  
533 541 return;
534 }
535  
536 21 1;
537  
538 __END__
↑ Summary /usr/local/bin/prove »