| 1 | package TAP::Formatter::BambooExtended::Session; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use parent qw(TAP::Formatter::Console::Session); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use TAP::Parser::ResultFactory (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = '1.01'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub _initialize { | ||||||||||||||||||||||||||
|
Subroutine
_initialize: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 13 | 0 | my ($self, $arg_for) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # variables that we use for ourselves | ||||||||||||||||||||||||||||
| 16 | 0 | $self->{'_results'} = []; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | return $self->SUPER::_initialize($arg_for || {}); | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_for || {}
MC/DC0%0/1
$arg_for || {}
$arg_for
Truth table0%0/2
A
A= $arg_for
| |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub result { | ||||||||||||||||||||||||||
|
Subroutine
result: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 0 | my ($self, $result) = @_; | |||||||||||||||||||||||||||
| 23 | 0 | push(@{$self->{'_results'}}, $result); | |||||||||||||||||||||||||||
| 24 | 0 | return; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub close_test { | ||||||||||||||||||||||||||
|
Subroutine
close_test: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 29 | 0 | my $parser = $self->parser(); | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | my $results = { | ||||||||||||||||||||||||||||
| 32 | 'description' => $self->name(), | ||||||||||||||||||||||||||||
| 33 | 'start_time' => $parser->start_time(), | ||||||||||||||||||||||||||||
| 34 | 'end_time' => $parser->end_time(), | ||||||||||||||||||||||||||||
| 35 | 'tests_run' => $parser->tests_run(), | ||||||||||||||||||||||||||||
| 36 | 'failed' => scalar($parser->failed()), | ||||||||||||||||||||||||||||
| 37 | 'parse_errors' => scalar($parser->parse_errors()), | ||||||||||||||||||||||||||||
| 38 | 0 | 'results' => $self->{'_results'}, | |||||||||||||||||||||||||||
| 39 | }; | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | my @fail_reasons = _fail_reasons($parser); | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | if (@fail_reasons) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | print STDERR "FAIL " . $self->name() . "\n" . join("", map { " $_\n" } @fail_reasons); | |||||||||||||||||||||||||||
| 44 | } else { | ||||||||||||||||||||||||||||
| 45 | 0 | print { $self->formatter->stdout() } "PASS " . $self->name() . "\n"; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $is_ok = (scalar(@fail_reasons) ? 'not ok' : 'ok'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | unshift(@{$self->{'_results'}}, TAP::Parser::ResultFactory->make_result({ | |||||||||||||||||||||||||||
| 50 | 'ok' => $is_ok, | ||||||||||||||||||||||||||||
| 51 | 0 | 'explanation' => join("", map { " $_\n" } @fail_reasons), | |||||||||||||||||||||||||||
| 52 | 'directive' => '', | ||||||||||||||||||||||||||||
| 53 | 'type' => 'test', | ||||||||||||||||||||||||||||
| 54 | 0 | 'test_num' => scalar(@{$self->{'_results'}}), | |||||||||||||||||||||||||||
| 55 | 'description' => $self->name(), | ||||||||||||||||||||||||||||
| 56 | 0 | 'raw' => "${is_ok} - ${\$self->name()}", | |||||||||||||||||||||||||||
| 57 | })); | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | $self->formatter->add_test_results($results); | |||||||||||||||||||||||||||
| 60 | 0 | return; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub _fail_reasons { | ||||||||||||||||||||||||||
|
Subroutine
_fail_reasons: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||
| 64 | 0 | my $parser = shift; | |||||||||||||||||||||||||||
| 65 | 0 | my @reasons = (); | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ($parser->failed()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 0 | push(@reasons, "failed tests (" . join(', ', $parser->failed()) . ")"); | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if ($parser->todo_passed()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 0 | push(@reasons, "unexpected TODO passed (" . join(', ', $parser->todo_passed()) . ")"); | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($parser->parse_errors()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | push(@reasons, "parse errors (" . join(', ', $parser->parse_errors()) . ")"); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if (!@reasons && $parser->exit() != 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not @reasons and $parser->exit != 0
MC/DC0%0/2
not @reasons and $parser->exit != 0
not @reasons
$parser->exit != 0
Truth table0%0/3
not(A) and B
A= not @reasonsB= $parser->exit != 0
| |||||||||||||||||||||||||||||
| 77 | 0 | push(@reasons, "non-zero exit code (" . $parser->exit(). ")"); | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if (!@reasons && $parser->has_problems()) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not @reasons and $parser->has_problems
MC/DC0%0/2
not @reasons and $parser->has_problems
not @reasons
$parser->has_problems
Truth table0%0/3
not(A) and B
A= not @reasonsB= $parser->has_problems
| |||||||||||||||||||||||||||||
| 80 | 0 | push(@reasons, "unknown reason (probably some bug encountered)"); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | return wantarray ? @reasons : \@reasons; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 1 | 1; | |||||||||||||||||||||||||||