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

filter: Statementstmt 93.9% 31 / 33 Branchbran 92.8% 13 / 14 Conditioncond 100% 24 / 24 MC/DCmcdc 100% 9 / 9 Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 96.5% 84 / 87 CC 16 SCAR 20.8
CC
16
Cov
96%
result
11.1
close_test
6.0
BEGIN
1.0
CRAP 8.0
« blib/lib/TAP/Formatter/Session.pm ↑ Summary blib/lib/TAP/Parser/Scheduler.pm »
1 package TAP::Formatter::File::Session;
2  
3 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use base 'TAP::Formatter::Session';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 TAP::Formatter::File::Session - Harness output delegate for file output
10  
11 =head1 VERSION
12  
13 Version 3.52
14  
15 =cut
16  
17 17 our $VERSION = '3.52';
18  
19 =head1 DESCRIPTION
20  
21 This provides file orientated output formatting for L<TAP::Harness>.
22 It is particularly important when running with parallel tests, as it
23 ensures that test results are not interleaved, even when run
24 verbosely.
25  
26 =cut
27  
28 =head1 METHODS
29  
30 =head2 result
31  
32 Stores results for later output, all together.
33  
34 =cut
35  
36 12614 ▶sub result {
Subroutine result: called CC=11 SCAR=24.0
Pod documented
37 12614 my $self = shift;
38 12614 my $result = shift;
39  
40 12614 my $parser = $self->parser;
41 12614 my $formatter = $self->formatter;
42  
43 12614 ▶ if ( $result->is_bailout ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($result->is_bailout) 0 12614 12614
44 0 $formatter->_failure_output(
45 "Bailout called. Further testing stopped: "
46 . $result->explanation
47 . "\n" );
48 0 return;
49 }
50  
51 12614 ▶ if (!$formatter->quiet
Branch: 1 branch
BranchTrueFalseTotal
if (not $formatter->quiet and $formatter->verbose || $result->is_test && $formatter->failures && !$result->is_ok || $formatter->comments && $result->is_comment || $result->has_directive && $formatter->directives) 31 12583 12614
Condition100%24/24
not $formatter->quiet and $formatter->verbose || $result->is_test && $formatter->failures && !$result->is_ok || $formatter->comments && $result->is_comment || $result->has_directive && $formatter->directives
!ll&&!rl&&r
741250931
$formatter->verbose or $result->is_test and $formatter->failures and not $result->is_ok or $formatter->comments and $result->is_comment or $result->has_directive and $formatter->directives
l!l&&r!l&&!r
29212509
$formatter->verbose or $result->is_test and $formatter->failures and not $result->is_ok or $formatter->comments and $result->is_comment
l!l&&r!l&&!r
21812511
$formatter->verbose or $result->is_test and $formatter->failures and not $result->is_ok
l!l&&r!l&&!r
19212519
$result->is_test and $formatter->failures and not $result->is_ok
!ll&&!rl&&r
1251722
$result->is_test and $formatter->failures
!ll&&!rl&&r
168123494
$formatter->comments and $result->is_comment
!ll&&!rl&&r
1250658
$result->has_directive and $formatter->directives
!ll&&!rl&&r
12464452
MC/DC100%9/9
not $formatter->quiet and $formatter->verbose || $result->is_test && $formatter->failures && !$result->is_ok || $formatter->comments && $result->is_comment || $result->has_directive && $formatter->directives
not $formatter->quiet $formatter->verbose $result->is_test $formatter->failures not $result->is_ok $formatter->comments $result->is_comment $result->has_directive $formatter->directives
Truth table54%13/24
not(A) and B or C and D and not(E) or F and G or H and I
A= not $formatter->quietB= $formatter->verboseC= $result->is_testD= $formatter->failuresE= not $result->is_okF= $formatter->commentsG= $result->is_commentH= $result->has_directiveI= $formatter->directives
ABCDEFGHIresult
0XXXXXXXX0
100XX0X0X0
100XX0X100
100XX100X0
100XX10100
1010X0X0X0
1010X0X100
1010X100X0
1010X10100
101100X0X0
101100X100
10110100X0
1011010100
11XXXXXXX1
10111XXXX1
100XX11XX1
1010X11XX1
1011011XX1
100XX0X111
100XX10111
1010X0X111
1010X10111
101100X111
1011010111
52 && ( $formatter->verbose
53 || ( $result->is_test && $formatter->failures && !$result->is_ok )
54 || ( $formatter->comments && $result->is_comment )
55 || ( $result->has_directive && $formatter->directives ) )
56 )
57 {
58 31 $self->{results} .= $self->_format_for_output($result) . "\n";
59 }
60 }
61  
62 =head2 close_test
63  
64 When the test file finishes, outputs the summary, together.
65  
66 =cut
67  
68 147 ▶sub close_test {
Subroutine close_test: called CC=6 SCAR=17.9
Pod documented
69 147 my $self = shift;
70  
71 # Avoid circular references
72 147 $self->parser(undef);
73  
74 147 my $parser = $self->parser;
75 147 my $formatter = $self->formatter;
76 147 my $pretty = $formatter->_format_name( $self->name );
77  
78 147 ▶ return if $formatter->really_quiet;
Branch: 1 branch
BranchTrueFalseTotal
if $formatter->really_quiet 19 128 147
79 128 ▶ if ( my $skip_all = $parser->skip_all ) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $skip_all = $parser->skip_all) { } 5 123 128
elsif ($parser->has_problems) { } 30 93 123
80 5 $formatter->_output( $pretty . "skipped: $skip_all\n" );
81 }
82 elsif ( $parser->has_problems ) {
83 $formatter->_output(
84 30 ▶ $pretty . ( $self->{results} ? "\n" . $self->{results} : "\n" ) );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'results'} ? : 5 25 30
85 30 $self->_output_test_failure($parser);
86 }
87 else {
88 93 my $time_report = $self->time_report( $formatter, $parser );
89 $formatter->_output(
90 93 ▶ $pretty . ( $self->{results} ? "\n" . $self->{results} : "" ) );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'results'} ? : 5 88 93
91 93 $formatter->_output_success( $self->_make_ok_line($time_report) );
92 }
93 }
94  
95 17 1;
« blib/lib/TAP/Formatter/Session.pm ↑ Summary blib/lib/TAP/Parser/Scheduler.pm »