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