| 1 | package Test2::Formatter::TAP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 455 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 455 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 455 | our $VERSION = '1.302226'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 455 | ▶ | use Test2::Util qw/clone_io/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 455 | ▶ | use Test2::Util::HashBase qw{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | no_numbers handles _encoding _last_fh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | -made_assertion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 455 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | sub OUT_STD() { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | sub OUT_ERR() { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 455 | ▶ | BEGIN { require Test2::Formatter; our @ISA = qw(Test2::Formatter) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 455 | my $supports_tables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | sub supports_tables { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
supports_tables: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | if (!defined $supports_tables) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | local $SIG{__DIE__} = 'DEFAULT'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | $supports_tables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | = ($INC{'Term/Table.pm'} && $INC{'Term/Table/Util.pm'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | ▶ | || eval { require Term::Table; require Term::Table::Util; 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition62%5/8
$INC{'Term/Table.pm'} && $INC{'Term/Table/Util.pm'} || eval {
do {
require Term::Table;
require Term::Table::Util;
1
}
} || 0
$INC{"Term/Table.pm"} and $INC{"Term/Table/Util.pm"} or eval {
do {
require Term::Table;
require Term::Table::Util;
1
}
}
$INC{"Term/Table.pm"} and $INC{"Term/Table/Util.pm"}
MC/DC0%0/3
$INC{'Term/Table.pm'} && $INC{'Term/Table/Util.pm'} || eval {
do {
require Term::Table;
require Term::Table::Util;
1
}
} || 0
$INC{"Term/Table.pm"}
$INC{"Term/Table/Util.pm"}
eval {
do {
require Term::Table;
require Term::Table::Util;
1
}
}
Truth table40%2/5
A and B or C
A= $INC{"Term/Table.pm"}B= $INC{"Term/Table/Util.pm"}C= eval {
do {
require Term::Table;
require Term::Table::Util;
1
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | return $supports_tables; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2062 | ▶ | sub _autoflush { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_autoflush: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2062 | my($fh) = pop; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2062 | my $old_fh = select $fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2062 | $| = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2062 | select $old_fh; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 455 | _autoflush(\*STDOUT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 455 | _autoflush(\*STDERR); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 416 | ▶ | sub hide_buffered { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hide_buffered: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 588 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 588 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 588 | ▶ | $self->{+HANDLES} ||= $self->_open_handles; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"handles"} ||= $self->_open_handles
MC/DC0%0/2
$self->{"handles"} ||= $self->_open_handles
$self->{"handles"}
$self->_open_handles
Truth table66%2/3
A ||= B
A= $self->{"handles"}B= $self->_open_handles
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 588 | ▶ | if(my $enc = delete $self->{encoding}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | $self->encoding($enc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 576 | ▶ | sub _open_handles { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_open_handles: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 576 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 576 | require Test2::API; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 576 | my $out = clone_io(Test2::API::test2_stdout()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 576 | my $err = clone_io(Test2::API::test2_stderr()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 576 | _autoflush($out); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 576 | _autoflush($err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 576 | return [$out, $err]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 168 | ▶ | sub encoding { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encoding: called CC=6 SCAR=18.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 168 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 168 | ▶ | if ("$]" >= 5.007003 and @_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
"$]" >= "5.007003" and @_
MC/DC50%1/2
"$]" >= "5.007003" and @_
"$]" >= "5.007003"
@_
Truth table66%2/3
A and B
A= "$]" >= "5.007003"B= @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 167 | my ($enc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 167 | my $handles = $self->{+HANDLES}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # https://rt.perl.org/Public/Bug/Display.html?id=31923 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # If utf8 is requested we use ':utf8' instead of ':encoding(utf8)' in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # order to avoid the thread segfault. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 167 | ▶ | if ($enc =~ m/^utf-?8$/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 167 | binmode($_, ":utf8") for @$handles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | binmode($_, ":encoding($enc)") for @$handles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 167 | $self->{+_ENCODING} = $enc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 168 | return $self->{+_ENCODING}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 455 | ▶ | if ($^C) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 455 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | ▶ | *write = sub {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 6413 | ▶ | sub write { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write: called CC=17 SCAR=28.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 6413 | my ($self, $e, $num, $f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | # The most common case, a pass event with no amnesty and a normal name. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 6413 | ▶ | return if $self->print_optimal_pass($e, $num); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2902 | ▶ | $f ||= $e->facet_data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$f ||= $e->facet_data
MC/DC0%0/2
$f ||= $e->facet_data
$f
$e->facet_data
Truth table66%2/3
A ||= B
A= $fB= $e->facet_data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2902 | ▶ | $self->encoding($f->{control}->{encoding}) if $f->{control}->{encoding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2902 | ▶ | my @tap = $self->event_tap($f, $num) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2540 | ▶ | $self->{+MADE_ASSERTION} = 1 if $f->{assert}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 2540 | ▶ | my $nesting = $f->{trace}->{nested} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$f->{'trace'}{'nested'} || 0
MC/DC100%1/1
$f->{'trace'}{'nested'} || 0
$f->{'trace'}{'nested'}
Truth table100%2/2
A
A= $f->{'trace'}{'nested'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2540 | my $handles = $self->{+HANDLES}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 2540 | my $indent = ' ' x $nesting; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # Local is expensive! Only do it if we really need to. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 2540 | ▶ | local($\, $,) = (undef, '') if $\ || $,; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$\ or $,
MC/DC50%1/2
$\ or $,
$\
$,
Truth table66%2/3
A or B
A= $\B= $,
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2540 | for my $set (@tap) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 455 | ▶ | no warnings 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 5782 | my ($hid, $msg) = @$set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 5782 | ▶ | next unless $msg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 5782 | ▶ | my $io = $handles->[$hid] or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | print $io "\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | if $ENV{HARNESS_ACTIVE} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | && $hid == OUT_ERR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 5782 | ▶ | && $self->{+_LAST_FH} != $io | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$ENV{"HARNESS_ACTIVE"} and $hid == 1 and $self->{"_last_fh"} != $io and $msg =~ /^#\s*Failed( \(TODO\))? test /
$ENV{"HARNESS_ACTIVE"} and $hid == 1 and $self->{"_last_fh"} != $io
$ENV{"HARNESS_ACTIVE"} and $hid == 1
MC/DC100%4/4
$ENV{"HARNESS_ACTIVE"} and $hid == 1 and $self->{"_last_fh"} != $io and $msg =~ /^#\s*Failed( \(TODO\))? test /
$ENV{"HARNESS_ACTIVE"}
$hid == 1
$self->{"_last_fh"} != $io
$msg =~ /^#\s*Failed( \(TODO\))? test /
Truth table100%5/5
A and B and C and D
A= $ENV{"HARNESS_ACTIVE"}B= $hid == 1C= $self->{"_last_fh"} != $ioD= $msg =~ /^#\s*Failed( \(TODO\))? test /
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | && $msg =~ m/^#\s*Failed( \(TODO\))? test /; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 5782 | ▶ | $msg =~ s/^/$indent/mg if $nesting; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 5782 | print $io $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 5782 | $self->{+_LAST_FH} = $io; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 6425 | ▶ | sub print_optimal_pass { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_optimal_pass: called CC=16 SCAR=27.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 6425 | my ($self, $e, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 6425 | my $type = ref($e); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # Only optimal if this is a Pass or a passing Ok | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 6425 | ▶ | return unless $type eq 'Test2::Event::Pass' || ($type eq 'Test2::Event::Ok' && $e->{pass}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$type eq "Test2::Event::Pass" or $type eq "Test2::Event::Ok" and $e->{"pass"}
$type eq "Test2::Event::Ok" and $e->{"pass"}
MC/DC100%3/3
$type eq "Test2::Event::Pass" or $type eq "Test2::Event::Ok" and $e->{"pass"}
$type eq "Test2::Event::Pass"
$type eq "Test2::Event::Ok"
$e->{"pass"}
Truth table100%4/4
A or B and C
A= $type eq "Test2::Event::Pass"B= $type eq "Test2::Event::Ok"C= $e->{"pass"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # Amnesty requires further processing (todo is a form of amnesty) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3559 | ▶ | return if ($e->{amnesty} && @{$e->{amnesty}}) || defined($e->{todo}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$e->{"amnesty"} and @{$e->{"amnesty"};} or defined $e->{"todo"}
$e->{"amnesty"} and @{$e->{"amnesty"};}
MC/DC66%2/3
$e->{"amnesty"} and @{$e->{"amnesty"};} or defined $e->{"todo"}
$e->{"amnesty"}
@{$e->{"amnesty"};}
defined $e->{"todo"}
Truth table60%3/5
A and B or C
A= $e->{"amnesty"}B= @{$e->{"amnesty"};}C= defined $e->{"todo"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # A name with a newline or hash symbol needs extra processing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 3532 | ▶ | return if defined($e->{name}) && (-1 != index($e->{name}, "\n") || -1 != index($e->{name}, '#')); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $e->{"name"} and index($e->{"name"}, "\n") != -1 || index($e->{"name"}, "#") != -1
index($e->{"name"}, "\n") != -1 or index($e->{"name"}, "#") != -1
MC/DC100%3/3
defined $e->{"name"} and index($e->{"name"}, "\n") != -1 || index($e->{"name"}, "#") != -1
defined $e->{"name"}
index($e->{"name"}, "\n") != -1
index($e->{"name"}, "#") != -1
Truth table100%4/4
A and B or C
A= defined $e->{"name"}B= index($e->{"name"}, "\n") != -1C= index($e->{"name"}, "#") != -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 3517 | my $ok = 'ok'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3517 | ▶ | $ok .= " $num" if $num && !$self->{+NO_NUMBERS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$num and not $self->{"no_numbers"}
MC/DC50%1/2
$num and not $self->{"no_numbers"}
$num
not $self->{"no_numbers"}
Truth table66%2/3
A and not(B)
A= $numB= not $self->{"no_numbers"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3517 | ▶ | $ok .= defined($e->{name}) ? " - $e->{name}\n" : "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3517 | ▶ | if (my $nesting = $e->{trace}->{nested}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 91 | my $indent = ' ' x $nesting; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 91 | $ok = "$indent$ok"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 3517 | my $io = $self->{+HANDLES}->[OUT_STD]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3517 | ▶ | local($\, $,) = (undef, '') if $\ || $,; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$\ or $,
MC/DC0%0/2
$\ or $,
$\
$,
Truth table33%1/3
A or B
A= $\B= $,
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 3517 | print $io $ok; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3517 | $self->{+_LAST_FH} = $io; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3517 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 5850 | ▶ | sub event_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
event_tap: called CC=14 SCAR=26.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 5850 | my ($self, $f, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 5850 | my @tap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # If this IS the first event the plan should come first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | # (plan must be before or after assertions, not in the middle) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 5850 | ▶ | push @tap => $self->plan_tap($f) if $f->{plan} && !$self->{+MADE_ASSERTION}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"plan"} and not $self->{"made_assertion"}
MC/DC100%2/2
$f->{"plan"} and not $self->{"made_assertion"}
$f->{"plan"}
not $self->{"made_assertion"}
Truth table100%3/3
A and not(B)
A= $f->{"plan"}B= not $self->{"made_assertion"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # The assertion is most important, if present. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 5850 | ▶ | if ($f->{assert}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3323 | push @tap => $self->assert_tap($f, $num); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3323 | ▶ | push @tap => $self->debug_tap($f, $num) unless $f->{assert}->{no_debug} || $f->{assert}->{pass}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"assert"}{"no_debug"} or $f->{"assert"}{"pass"}
MC/DC100%2/2
$f->{"assert"}{"no_debug"} or $f->{"assert"}{"pass"}
$f->{"assert"}{"no_debug"}
$f->{"assert"}{"pass"}
Truth table100%3/3
A or B
A= $f->{"assert"}{"no_debug"}B= $f->{"assert"}{"pass"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # Almost as important as an assertion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5850 | ▶ | push @tap => $self->error_tap($f) if $f->{errors}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # Now lets see the diagnostics messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 5850 | ▶ | push @tap => $self->info_tap($f) if $f->{info}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # If this IS NOT the first event the plan should come last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # (plan must be before or after assertions, not in the middle) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 5850 | ▶ | push @tap => $self->plan_tap($f) if $self->{+MADE_ASSERTION} && $f->{plan}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"made_assertion"} and $f->{"plan"}
MC/DC100%2/2
$self->{"made_assertion"} and $f->{"plan"}
$self->{"made_assertion"}
$f->{"plan"}
Truth table100%3/3
A and B
A= $self->{"made_assertion"}B= $f->{"plan"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # Bail out | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 5850 | ▶ | push @tap => $self->halt_tap($f) if $f->{control}->{halt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 5850 | ▶ | return @tap if @tap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 517 | ▶ | return @tap if $f->{control}->{halt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 515 | ▶ | return @tap if grep { $f->{$_} } qw/assert plan info errors/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # Use the summary as a fallback if nothing else is usable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 511 | return $self->summary_tap($f, $num); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 5 | ▶ | sub error_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_tap: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 5 | my ($f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $IO = ($f->{amnesty} && @{$f->{amnesty}}) ? OUT_STD : OUT_ERR; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$f->{"amnesty"} and @{$f->{"amnesty"};}
MC/DC0%0/2
$f->{"amnesty"} and @{$f->{"amnesty"};}
$f->{"amnesty"}
@{$f->{"amnesty"};}
Truth table33%1/3
A and B
A= $f->{"amnesty"}B= @{$f->{"amnesty"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 7 | my $details = $_->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 7 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 7 | ▶ | if (ref($details)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | require Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | my $dumper = Data::Dumper->new([$details])->Indent(2)->Terse(1)->Pad('# ')->Useqq(1)->Sortkeys(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | chomp($msg = $dumper->Dump); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 6 | chomp($msg = $details); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 6 | $msg =~ s/^/# /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 6 | $msg =~ s/\n/\n# /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 7 | [$IO, "$msg\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 5 | } @{$f->{errors}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 979 | ▶ | sub plan_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plan_tap: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 979 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 979 | my ($f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 979 | ▶ | my $plan = $f->{plan} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 978 | ▶ | return if $plan->{none}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 976 | ▶ | if ($plan->{skip}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 44 | ▶ | my $reason = $plan->{details} or return [OUT_STD, "1..0 # SKIP\n"]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 41 | chomp($reason); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 41 | return [OUT_STD, '1..0 # SKIP ' . $reason . "\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 932 | return [OUT_STD, "1.." . $plan->{count} . "\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 2713 | ▶ | sub no_subtest_space { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_subtest_space: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 3363 | ▶ | sub assert_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
assert_tap: called CC=32 SCAR=34.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 3363 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 3363 | my ($f, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 3363 | ▶ | my $assert = $f->{assert} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 3363 | my $pass = $assert->{pass}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 3363 | my $name = $assert->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 3363 | ▶ | my $ok = $pass ? 'ok' : 'not ok'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 3363 | ▶ | $ok .= " $num" if $num && !$self->{+NO_NUMBERS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$num and not $self->{"no_numbers"}
MC/DC50%1/2
$num and not $self->{"no_numbers"}
$num
not $self->{"no_numbers"}
Truth table66%2/3
A and not(B)
A= $numB= not $self->{"no_numbers"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # The regex form is ~250ms, the index form is ~50ms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 3363 | my @extra; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 3363 | ▶ | defined($name) && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
index($name, "\n") != -1 and ($name, @extra) = split(/\n\r?/, $name, -1)
index($name, "#") != -1 || substr($name, -1) eq "\\" and $name =~ s/\\/\\\\/g, $name =~ s/#/\\#/g
index($name, "#") != -1 or substr($name, -1) eq "\\"
MC/DC0%0/2
index($name, "\n") != -1 and ($name, @extra) = split(/\n\r?/, $name, -1)
index($name, "\n") != -1
($name, @extra) = split(/\n\r?/, $name, -1)
MC/DC0%0/3
index($name, "#") != -1 || substr($name, -1) eq "\\" and $name =~ s/\\/\\\\/g, $name =~ s/#/\\#/g
index($name, "#") != -1
substr($name, -1) eq "\\"
$name =~ s/\\/\\\\/g, $name =~ s/#/\\#/g
Truth table66%2/3
A and B
A= index($name, "\n") != -1B= ($name, @extra) = split(/\n\r?/, $name, -1)
Truth table0%0/5
A or B and C
A= index($name, "#") != -1B= substr($name, -1) eq "\\"C= $name =~ s/\\/\\\\/g, $name =~ s/#/\\#/g
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | (index($name, "\n") != -1 && (($name, @extra) = split(/\n\r?/, $name, -1))), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | ((index($name, "#" ) != -1 || substr($name, -1) eq '\\') && (($name =~ s|\\|\\\\|g), ($name =~ s|#|\\#|g))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 3363 | ▶ | my $extra_space = @extra ? ' ' x (length($ok) + 2) : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 3363 | my $extra_indent = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 3363 | my ($directives, $reason, $is_skip); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 3363 | ▶ | if ($f->{amnesty}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 352 | my %directives; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 352 | for my $am (@{$f->{amnesty}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 365 | ▶ | next if $am->{inherited}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 364 | ▶ | my $tag = $am->{tag} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 364 | ▶ | $is_skip = 1 if $tag eq 'skip'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 364 | ▶ | $directives{$tag} ||= $am->{details}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$directives{$tag} ||= $am->{"details"}
MC/DC100%2/2
$directives{$tag} ||= $am->{"details"}
$directives{$tag}
$am->{"details"}
Truth table100%3/3
A ||= B
A= $directives{$tag}B= $am->{"details"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 352 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # Sort so that TODO comes before skip even on systems where lc sorts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | # before uc, as other code depends on that ordering. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 352 | my @order = grep { !$seen{$_}++ } sort { lc $b cmp lc $a } keys %directives; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 352 | $directives = ' # ' . join ' & ' => @order; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 352 | for my $tag ('skip', @order) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 659 | ▶ | next unless defined($directives{$tag}) && length($directives{$tag}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $directives{$tag} and length $directives{$tag}
MC/DC100%2/2
defined $directives{$tag} and length $directives{$tag}
defined $directives{$tag}
length $directives{$tag}
Truth table100%3/3
A and B
A= defined $directives{$tag}B= length $directives{$tag}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 294 | $reason = $directives{$tag}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 294 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 3363 | ▶ | $ok .= " - $name" if defined $name && !($is_skip && !$name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $name and not $is_skip && !$name
$is_skip && !$name
MC/DC100%3/3
defined $name and not $is_skip && !$name
defined $name
$is_skip
!$name
Truth table100%4/4
A and not(B && not(C))
A= defined $nameB= $is_skipC= !$name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 3363 | my @subtap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 3363 | ▶ | if ($f->{parent} && $f->{parent}->{buffered}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"parent"} and $f->{"parent"}{"buffered"}
MC/DC100%2/2
$f->{"parent"} and $f->{"parent"}{"buffered"}
$f->{"parent"}
$f->{"parent"}{"buffered"}
Truth table100%3/3
A and B
A= $f->{"parent"}B= $f->{"parent"}{"buffered"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 410 | $ok .= ' {'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # In a verbose harness we indent the extra since they will appear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # inside the subtest braces. This helps readability. In a non-verbose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # harness we do not do this because it is less readable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 410 | ▶ | if ($ENV{HARNESS_IS_VERBOSE} || !$ENV{HARNESS_ACTIVE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ENV{"HARNESS_IS_VERBOSE"} or not $ENV{"HARNESS_ACTIVE"}
MC/DC0%0/2
$ENV{"HARNESS_IS_VERBOSE"} or not $ENV{"HARNESS_ACTIVE"}
$ENV{"HARNESS_IS_VERBOSE"}
not $ENV{"HARNESS_ACTIVE"}
Truth table33%1/3
A or not(B)
A= $ENV{"HARNESS_IS_VERBOSE"}B= not $ENV{"HARNESS_ACTIVE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $extra_indent = " "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $extra_space = ' '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # Render the sub-events, we use our own counter for these. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 410 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | @subtap = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2939 | my $f2 = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # Bump the count for any event that should bump it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 2939 | ▶ | $count++ if $f2->{assert}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | # This indents all output lines generated for the sub-events. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # index 0 is the filehandle, index 1 is the message we want to indent. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2939 | map { $_->[1] =~ s/^(.*\S.*)$/ $1/mg; $_ } $self->event_tap($f2, $count); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 410 | } @{$f->{parent}->{children}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 410 | push @subtap => [OUT_STD, "}\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 3363 | ▶ | if ($directives) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 352 | ▶ | $directives = ' # TODO & SKIP' if $directives eq ' # TODO & skip'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 352 | $ok .= $directives; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 352 | ▶ | $ok .= " $reason" if defined($reason); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 3363 | ▶ | $extra_space = ' ' if $self->no_subtest_space; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 3363 | my @out = ([OUT_STD, "$ok\n"]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 3363 | ▶ | push @out => map {[OUT_STD, "${extra_indent}#${extra_space}$_\n"]} @extra if @extra; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 3363 | push @out => @subtap; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 3363 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 24 | ▶ | sub debug_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_tap: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 24 | my ($self, $f, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # Figure out the debug info, this is typically the file name and line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # number, but can also be a custom message. If no trace object is provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # then we have nothing useful to display. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 24 | my $name = $f->{assert}->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 24 | my $trace = $f->{trace}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 24 | my $debug = "[No trace info available]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 24 | ▶ | if ($trace->{details}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | $debug = $trace->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | elsif ($trace->{frame}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 20 | my ($pkg, $file, $line) = @{$trace->{frame}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 20 | ▶ | $debug = "at $file line $line." if $file && $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$file and $line
MC/DC0%0/2
$file and $line
$file
$line
Truth table33%1/3
A and B
A= $fileB= $line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 24 | ▶ | my $amnesty = $f->{amnesty} && @{$f->{amnesty}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"amnesty"} and @{$f->{"amnesty"};}
MC/DC100%2/2
$f->{"amnesty"} and @{$f->{"amnesty"};}
$f->{"amnesty"}
@{$f->{"amnesty"};}
Truth table100%3/3
A and B
A= $f->{"amnesty"}B= @{$f->{"amnesty"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | ? ' (with amnesty)' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | # Create the initial diagnostics. If the test has a name we put the debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # info on a second line, this behavior is inherited from Test::Builder. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 24 | ▶ | my $msg = defined($name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | ? qq[# Failed test${amnesty} '$name'\n# $debug\n] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | : qq[# Failed test${amnesty} $debug\n]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 24 | ▶ | my $IO = $f->{amnesty} && @{$f->{amnesty}} ? OUT_STD : OUT_ERR; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"amnesty"} and @{$f->{"amnesty"};}
MC/DC100%2/2
$f->{"amnesty"} and @{$f->{"amnesty"};}
$f->{"amnesty"}
@{$f->{"amnesty"};}
Truth table100%3/3
A and B
A= $f->{"amnesty"}B= @{$f->{"amnesty"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 24 | return [$IO, $msg]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 13 | ▶ | sub halt_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
halt_tap: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 13 | my ($self, $f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 13 | ▶ | return if $f->{trace}->{nested} && !$f->{trace}->{buffered}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$f->{"trace"}{"nested"} and not $f->{"trace"}{"buffered"}
MC/DC100%2/2
$f->{"trace"}{"nested"} and not $f->{"trace"}{"buffered"}
$f->{"trace"}{"nested"}
not $f->{"trace"}{"buffered"}
Truth table100%3/3
A and not(B)
A= $f->{"trace"}{"nested"}B= not $f->{"trace"}{"buffered"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 10 | my $details = $f->{control}->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 10 | ▶ | return [OUT_STD, "Bail out!\n"] unless defined($details) && length($details); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $details and length $details
MC/DC100%2/2
defined $details and length $details
defined $details
length $details
Truth table100%3/3
A and B
A= defined $detailsB= length $details
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 7 | return [OUT_STD, "Bail out! $details\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 1041 | ▶ | sub info_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info_tap: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 1041 | my ($self, $f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | return map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 1051 | my $details = $_->{details}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 1051 | my $table = $_->{table}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 1051 | ▶ | my $IO = $_->{debug} && !($f->{amnesty} && @{$f->{amnesty}}) ? OUT_ERR : OUT_STD; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$_->{"debug"} and not $f->{"amnesty"} && @{$f->{"amnesty"};}
$f->{'amnesty'} && @{$f->{'amnesty'};}
MC/DC66%2/3
$_->{"debug"} and not $f->{"amnesty"} && @{$f->{"amnesty"};}
$_->{"debug"}
$f->{'amnesty'}
@{$f->{'amnesty'};}
Truth table75%3/4
A and not(B && C)
A= $_->{"debug"}B= $f->{'amnesty'}C= @{$f->{'amnesty'};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1051 | my $msg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 1051 | ▶ | if ($table && $self->supports_tables) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$table and $self->supports_tables
MC/DC100%2/2
$table and $self->supports_tables
$table
$self->supports_tables
Truth table100%3/3
A and B
A= $tableB= $self->supports_tables
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 5 | my $size = $self->calc_table_size($f); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 43 | $msg = join "\n" => map { "# $_" } Term::Table->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | header => $table->{header}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | rows => $table->{rows}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | collapse => $table->{collapse}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | no_collapse => $table->{no_collapse}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 5 | sanitize => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | mark_tail => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | max_width => $size, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | )->render(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | $msg .= "\n(If this table is too small, you can use the TABLE_TERM_SIZE=### env var to set a larger size, detected size is '$size')\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | if $size <= 80 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 5 | ▶ | && !$ENV{TABLE_TERM_SIZE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$size <= 80 and not $ENV{"TABLE_TERM_SIZE"}
MC/DC0%0/2
$size <= 80 and not $ENV{"TABLE_TERM_SIZE"}
$size <= 80
not $ENV{"TABLE_TERM_SIZE"}
Truth table33%1/3
A and not(B)
A= $size <= 80B= not $ENV{"TABLE_TERM_SIZE"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | elsif (ref($details)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 2 | require Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | my $dumper = Data::Dumper->new([$details])->Indent(2)->Terse(1)->Pad('# ')->Useqq(1)->Sortkeys(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 2 | chomp($msg = $dumper->Dump); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1044 | chomp($msg = $details); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 1044 | $msg =~ s/^/# /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 1044 | $msg =~ s/\n/\n# /g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 1051 | [$IO, "$msg\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1041 | } @{$f->{info}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 514 | ▶ | sub summary_tap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary_tap: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 514 | my ($self, $f, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 514 | ▶ | return if $f->{about}->{no_display}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 359 | ▶ | my $summary = $f->{about}->{details} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 2 | chomp($summary); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 2 | $summary =~ s/^/# /smg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 2 | return [OUT_STD, "$summary\n"]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 5 | ▶ | sub calc_table_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calc_table_size: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 5 | my ($f) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | my $term = Term::Table::Util::term_size(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 5 | ▶ | my $nesting = 2 + (($f->{trace}->{nested} || 0) * 4); # 4 spaces per level, also '# ' prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$f->{'trace'}{'nested'} || 0
MC/DC100%1/1
$f->{'trace'}{'nested'} || 0
$f->{'trace'}{'nested'}
Truth table100%2/2
A
A= $f->{'trace'}{'nested'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 5 | my $total = $term - $nesting; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # Sane minimum width, any smaller and we are asking for pain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 5 | ▶ | return 50 if $total < 50; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 5 | return $total; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 455 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||