blib/lib/Test2/Compare/Delta.pm

filter: Statementstmt 99.4% 193 / 194 Branchbran 97.1% 101 / 104 Conditioncond 89.8% 44 / 49 MC/DCmcdc 80.6% 25 / 31 Subroutinesub 100% 34 / 34 Podpod 86.6% 13 / 15 totaltotal 96.0% 410 / 427 CC 75 SCAR 17.7
CC
75
Cov
97%
_arrow_id
11.0
table
10.0
_full_id
9.0
CRAP 5.9
« blib/lib/Test2/Tools/Mock.pm ↑ Summary blib/lib/Test2/Hub/Interceptor.pm »
1 package Test2::Compare::Delta;
2 176 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 176 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 176 our $VERSION = '1.302226';
6  
7 176 ▶use Test2::Util::HashBase qw{verified id got chk children dne exception note};
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 176 ▶use Test2::EventFacet::Info::Table;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 176 ▶use Test2::Util::Table();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 176 ▶use Test2::API qw/context/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 176 ▶use Test2::Util::Ref qw/render_ref rtype/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 176 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # 'CHECK' constant would not work, but I like exposing 'check()' to people
18 # using this class.
19 176 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
20 176 ▶ no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 176 *check = \&chk;
22 176 *set_check = \&set_chk;
23 }
24  
25 176 my @COLUMN_ORDER = qw/PATH GLNs GOT OP CHECK CLNs/;
26 my %COLUMNS = (
27 332 ▶ GOT => {name => 'GOT', value => sub { $_[0]->render_got }, no_collapse => 1},
Subroutine __ANON__: called CC=1 SCAR=0.0
28 332 ▶ CHECK => {name => 'CHECK', value => sub { $_[0]->render_check }, no_collapse => 1},
Subroutine __ANON__: called CC=1 SCAR=0.0
29 332 ▶ OP => {name => 'OP', value => sub { $_[0]->table_op } },
Subroutine __ANON__: called CC=1 SCAR=0.0
30 332 ▶ PATH => {name => 'PATH', value => sub { $_[1] } },
Subroutine __ANON__: called CC=1 SCAR=0.0
31  
32 332 ▶ 'GLNs' => {name => 'GLNs', alias => 'LNs', value => sub { $_[0]->table_got_lines } },
Subroutine __ANON__: called CC=1 SCAR=0.0
33 332 ▶ 'CLNs' => {name => 'CLNs', alias => 'LNs', value => sub { $_[0]->table_check_lines }},
Subroutine __ANON__: called CC=1 SCAR=0.0
34 176 );
35 {
36 176 my $i = 0;
37 176 $COLUMNS{$_}->{id} = $i++ for @COLUMN_ORDER;
38 }
39  
40 5 ▶sub remove_column {
Subroutine remove_column: called CC=2 SCAR=6.9
Pod documented
41 5 my $class = shift;
42 5 my $header = shift;
43 5 @COLUMN_ORDER = grep { $_ ne $header } @COLUMN_ORDER;
44 5 ▶ delete $COLUMNS{$header} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
delete $COLUMNS{$header} ? : 3 2 5
45 }
46  
47 8 ▶sub add_column {
Subroutine add_column: called CC=7 SCAR=19.5
Pod documented
48 8 my $class = shift;
49 8 my $name = shift;
50  
51 8 ▶ croak "Column name is required"
Branch: 1 branch
BranchTrueFalseTotal
unless $name 1 7 8
52 unless $name;
53  
54 croak "Column '$name' is already defined"
55 7 ▶ if $COLUMNS{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $COLUMNS{$name} 1 6 7
56  
57 6 my %params;
58 6 ▶ if (@_ == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 4 2 6
59 4 %params = (value => @_, name => $name);
60 }
61 else {
62 2 %params = (@_, name => $name);
63 }
64  
65 6 my $value = $params{value};
66  
67 6 ▶ croak "You must specify a 'value' callback"
Branch: 1 branch
BranchTrueFalseTotal
unless $value 1 5 6
68 unless $value;
69  
70 5 ▶ croak "'value' callback must be a CODE reference"
Branch: 1 branch
BranchTrueFalseTotal
unless rtype($value) eq "CODE" 1 4 5
71 unless rtype($value) eq 'CODE';
72  
73 4 ▶ if ($params{prefix}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{'prefix'}) { } 1 3 4
74 1 unshift @COLUMN_ORDER => $name;
75 }
76 else {
77 3 push @COLUMN_ORDER => $name;
78 }
79  
80 4 $COLUMNS{$name} = \%params;
81 }
82  
83 5 ▶sub set_column_alias {
Subroutine set_column_alias: called CC=3 SCAR=11.0
Pod documented
84 5 my ($class, $name, $alias) = @_;
85  
86 croak "Tried to alias a non-existent column"
87 5 ▶ unless exists $COLUMNS{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $COLUMNS{$name} 1 4 5
88  
89 4 ▶ croak "Missing alias" unless defined $alias;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $alias 1 3 4
90  
91 3 $COLUMNS{$name}->{alias} = $alias;
92 }
93  
94 2500 ▶sub init {
Subroutine init: called CC=5 SCAR=16.1
Pod undocumented
95 2500 my $self = shift;
96  
97 croak "Cannot specify both 'check' and 'chk' as arguments"
98 2500 ▶ if exists($self->{check}) && exists($self->{+CHK});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"check"} and exists $self->{"chk"} 1 2499 2500
Condition100%3/3
exists $self->{"check"} and exists $self->{"chk"}
!ll&&!rl&&r
1524841
MC/DC100%2/2
exists $self->{"check"} and exists $self->{"chk"}
exists $self->{"check"} exists $self->{"chk"}
Truth table100%3/3
A and B
A= exists $self->{"check"}B= exists $self->{"chk"}
ABresult
0X0
100
111
99  
100 # Allow 'check' as an argument
101 $self->{+CHK} ||= delete $self->{check}
102 2499 ▶ if exists $self->{check};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"check"} 2484 15 2499
Condition66%2/3
$self->{"chk"} ||= delete $self->{"check"}
l!l&&r!l&&!r
0245529
MC/DC50%1/2
$self->{"chk"} ||= delete $self->{"check"}
$self->{"chk"} delete $self->{"check"}
Truth table66%2/3
A ||= B
A= $self->{"chk"}B= delete $self->{"check"}
ABresult
1X1
011
000
103 }
104  
105 336 ▶sub render_got {
Subroutine render_got: called CC=8 SCAR=20.8
Pod documented
106 336 my $self = shift;
107  
108 336 my $exp = $self->{+EXCEPTION};
109 336 ▶ if ($exp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($exp) 1 335 336
110 1 chomp($exp = "$exp");
111 1 $exp =~ s/\n.*$//g;
112 1 return "<EXCEPTION: $exp>";
113 }
114  
115 335 my $dne = $self->{+DNE};
116 335 ▶ return '<DOES NOT EXIST>' if $dne && $dne eq 'got';
Branch: 1 branch
BranchTrueFalseTotal
if $dne and $dne eq "got" 21 314 335
Condition100%3/3
$dne and $dne eq "got"
!ll&&!rl&&r
3001421
MC/DC100%2/2
$dne and $dne eq "got"
$dne $dne eq "got"
Truth table100%3/3
A and B
A= $dneB= $dne eq "got"
ABresult
0X0
100
111
117  
118 314 my $got = $self->{+GOT};
119 314 ▶ return '<UNDEF>' unless defined $got;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $got 15 299 314
120  
121 299 my $check = $self->{+CHK};
122 299 ▶ my $stringify = defined( $check ) && $check->stringify_got;
Condition100%3/3
defined $check && $check->stringify_got
!ll&&!rl&&r
1521371
MC/DC100%2/2
defined $check && $check->stringify_got
defined $check $check->stringify_got
Truth table100%3/3
A && B
A= defined $checkB= $check->stringify_got
ABresult
0X0
100
111
123  
124 299 ▶ return render_ref($got) if ref $got && !$stringify;
Branch: 1 branch
BranchTrueFalseTotal
if ref $got and not $stringify 66 233 299
Condition100%3/3
ref $got and not $stringify
!ll&&!rl&&r
229466
MC/DC100%2/2
ref $got and not $stringify
ref $got not $stringify
Truth table100%3/3
A and not(B)
A= ref $gotB= not $stringify
ABresult
0X0
100
111
125  
126 233 return "$got";
127 }
128  
129 334 ▶sub render_check {
Subroutine render_check: called CC=4 SCAR=13.9
Pod documented
130 334 my $self = shift;
131  
132 334 my $dne = $self->{+DNE};
133 334 ▶ return '<DOES NOT EXIST>' if $dne && $dne eq 'check';
Branch: 1 branch
BranchTrueFalseTotal
if $dne and $dne eq "check" 14 320 334
Condition100%3/3
$dne and $dne eq "check"
!ll&&!rl&&r
2992114
MC/DC100%2/2
$dne and $dne eq "check"
$dne $dne eq "check"
Truth table100%3/3
A and B
A= $dneB= $dne eq "check"
ABresult
0X0
100
111
134  
135 320 my $check = $self->{+CHK};
136 320 ▶ return '<UNDEF>' unless defined $check;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $check 2 318 320
137  
138 318 return $check->render;
139 }
140  
141 171 ▶sub _full_id {
Subroutine _full_id: called CC=9 SCAR=22.0
142 171 my ($type, $id) = @_;
143 171 ▶ return "<$id>" if !$type || $type eq 'META';
Branch: 1 branch
BranchTrueFalseTotal
if not $type or $type eq "META" 37 134 171
Condition100%3/3
not $type or $type eq "META"
l!l&&r!l&&!r
829134
MC/DC100%2/2
not $type or $type eq "META"
not $type $type eq "META"
Truth table100%3/3
not(A) or B
A= not $typeB= $type eq "META"
ABresult
1X1
011
000
144 134 ▶ return $id if $type eq 'SCALAR';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "SCALAR" 9 125 134
145 125 ▶ return "{$id}" if $type eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "HASH" 43 82 125
146 82 ▶ return "{$id} <KEY>" if $type eq 'HASHKEY';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "HASHKEY" 3 79 82
147 79 ▶ return "[$id]" if $type eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "ARRAY" 60 19 79
148 19 ▶ return "$id()" if $type eq 'METHOD';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "METHOD" 17 2 19
149 2 ▶ return "$id" if $type eq 'DEREF';
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "DEREF" 2 0 2
150 0 return "<$id>";
151 }
152  
153 180 ▶sub _arrow_id {
Subroutine _arrow_id: called CC=11 SCAR=24.0
154 180 my ($path, $type) = @_;
155 180 ▶ return '' unless $path;
Branch: 1 branch
BranchTrueFalseTotal
unless $path 115 65 180
156  
157 65 ▶ return ' ' if !$type || $type eq 'META'; # Meta gets a space, not an arrow
Branch: 1 branch
BranchTrueFalseTotal
if not $type or $type eq "META" 15 50 65
Condition100%3/3
not $type or $type eq "META"
l!l&&r!l&&!r
8750
MC/DC100%2/2
not $type or $type eq "META"
not $type $type eq "META"
Truth table100%3/3
not(A) or B
A= not $typeB= $type eq "META"
ABresult
1X1
011
000
158  
159 50 ▶ return '->' if $type eq 'METHOD'; # Method always needs an arrow
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "METHOD" 7 43 50
160 43 ▶ return '->' if $type eq 'SCALAR'; # Scalar always needs an arrow
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "SCALAR" 7 36 43
161 36 ▶ return '->' if $type eq 'DEREF'; # deref always needs arrow
Branch: 1 branch
BranchTrueFalseTotal
if $type eq "DEREF" 1 35 36
162 35 ▶ return '->' if $path =~ m/(>|\(\))$/; # Need an arrow after meta, or after a method
Branch: 1 branch
BranchTrueFalseTotal
if $path =~ /(>|\(\))$/ 6 29 35
163 29 ▶ return '->' if $path eq '$VAR'; # Need an arrow after the initial ref
Branch: 1 branch
BranchTrueFalseTotal
if $path eq "\$VAR" 3 26 29
164  
165 # Hash and array need an arrow unless they follow another hash/array
166 26 ▶ return '->' if $type =~ m/^(HASH|ARRAY)$/ && $path !~ m/(\]|\})$/;
Branch: 1 branch
BranchTrueFalseTotal
if $type =~ /^(HASH|ARRAY)$/ and not $path =~ /(\]|\})$/ 5 21 26
Condition66%2/3
$type =~ /^(HASH|ARRAY)$/ and not $path =~ /(\]|\})$/
!ll&&!rl&&r
0215
MC/DC50%1/2
$type =~ /^(HASH|ARRAY)$/ and not $path =~ /(\]|\})$/
$type =~ /^(HASH|ARRAY)$/ not $path =~ /(\]|\})$/
Truth table66%2/3
A and not(B)
A= $type =~ /^(HASH|ARRAY)$/B= not $path =~ /(\]|\})$/
ABresult
0X0
100
111
167  
168 # No arrow needed
169 21 return '';
170 }
171  
172 165 ▶sub _join_id {
Subroutine _join_id: called CC=1 SCAR=0.0
173 165 my ($path, $parts) = @_;
174 165 my ($type, $key) = @$parts;
175  
176 165 my $id = _full_id($type, $key);
177 165 my $join = _arrow_id($path, $type);
178  
179 165 return "${path}${join}${id}";
180 }
181  
182 363 ▶sub should_show {
Subroutine should_show: called CC=6 SCAR=17.9
Pod documented
183 363 my $self = shift;
184 363 ▶ return 1 unless $self->verified;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->verified 286 77 363
185 77 ▶ defined( my $check = $self->check ) || return 0;
Branch: 1 branch
BranchTrueFalseTotal
defined(my $check = $self->check) or return 0 74 3 77
186 74 ▶ return 0 unless $check->lines;
Branch: 1 branch
BranchTrueFalseTotal
unless $check->lines 0 74 74
187 74 ▶ my $file = $check->file || return 0;
Condition100%2/2
$check->file || (return 0)
l!l
5024
MC/DC100%1/1
$check->file || (return 0)
$check->file
Truth table100%2/2
A
A= $check->file
Aresult
11
00
188  
189 50 my $ctx = context();
190 50 my $cfile = $ctx->trace->file;
191 50 $ctx->release;
192 50 ▶ return 0 unless $file eq $cfile;
Branch: 1 branch
BranchTrueFalseTotal
unless $file eq $cfile 1 49 50
193  
194 49 return 1;
195 }
196  
197 234 ▶sub filter_visible {
Subroutine filter_visible: called CC=6 SCAR=17.9
Pod documented
198 234 my $self = shift;
199  
200 234 my @deltas;
201 234 my @queue = (['', $self]);
202  
203 234 ▶ while (my $set = shift @queue) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $set = shift @queue) 357 234 591
204 357 my ($path, $delta) = @$set;
205  
206 357 ▶ push @deltas => [$path, $delta] if $delta->should_show;
Branch: 1 branch
BranchTrueFalseTotal
if $delta->should_show 333 24 357
207  
208 357 ▶ my $children = $delta->children || next;
Condition100%2/2
$delta->children || (next)
l!l
33225
MC/DC100%1/1
$delta->children || (next)
$delta->children
Truth table100%2/2
A
A= $delta->children
Aresult
11
00
209 332 ▶ next unless @$children;
Branch: 1 branch
BranchTrueFalseTotal
unless @$children 260 72 332
210  
211 72 my @new;
212 72 for my $child (@$children) {
213 123 my $cpath = _join_id($path, $child->id);
214 123 push @new => [$cpath, $child];
215 }
216 72 unshift @queue => @new;
217 }
218  
219 234 return \@deltas;
220 }
221  
222 240 ▶sub table_header { [map {$COLUMNS{$_}->{alias} || $_} @COLUMN_ORDER] }
Subroutine table_header: called CC=2 SCAR=7.1
Pod documented
Condition66%2/3
$COLUMNS{$_}{'alias'} || $_
l!l&&r!l&&!r
4889580
MC/DC0%0/2
$COLUMNS{$_}{'alias'} || $_
$COLUMNS{$_}{'alias'} $_
Truth table66%2/3
A || B
A= $COLUMNS{$_}{'alias'}B= $_
ABresult
1X1
011
000
223  
224 334 ▶sub table_op {
Subroutine table_op: called CC=4 SCAR=13.9
Pod documented
225 334 my $self = shift;
226  
227 334 ▶ defined( my $check = $self->{+CHK} ) || return '!exists';
Branch: 1 branch
BranchTrueFalseTotal
defined(my $check = $self->{"chk"}) or return "!exists" 320 14 334
228  
229 return $check->operator($self->{+GOT})
230 320 ▶ unless $self->{+DNE} && $self->{+DNE} eq 'got';
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"dne"} and $self->{"dne"} eq "got" 299 21 320
Condition100%3/3
$self->{"dne"} and $self->{"dne"} eq "got"
!ll&&!rl&&r
298121
MC/DC100%2/2
$self->{"dne"} and $self->{"dne"} eq "got"
$self->{"dne"} $self->{"dne"} eq "got"
Truth table100%3/3
A and B
A= $self->{"dne"}B= $self->{"dne"} eq "got"
ABresult
0X0
100
111
231  
232 21 return $check->operator();
233 }
234  
235 334 ▶sub table_check_lines {
Subroutine table_check_lines: called CC=4 SCAR=13.9
Pod documented
236 334 my $self = shift;
237  
238 334 ▶ defined( my $check = $self->{+CHK} ) || return '';
Branch: 1 branch
BranchTrueFalseTotal
defined(my $check = $self->{"chk"}) or return "" 320 14 334
239 320 ▶ my $lines = $check->lines || return '';
Condition50%1/2
$check->lines || (return '')
l!l
3200
MC/DC0%0/1
$check->lines || (return '')
$check->lines
Truth table50%1/2
A
A= $check->lines
Aresult
11
00
240  
241 320 ▶ return '' unless @$lines;
Branch: 1 branch
BranchTrueFalseTotal
unless @$lines 41 279 320
242  
243 279 return join ', ' => @$lines;
244 }
245  
246 335 ▶sub table_got_lines {
Subroutine table_got_lines: called CC=5 SCAR=16.1
Pod documented
247 335 my $self = shift;
248  
249 335 ▶ defined( my $check = $self->{+CHK} ) || return '';
Branch: 1 branch
BranchTrueFalseTotal
defined(my $check = $self->{"chk"}) or return "" 321 14 335
250 321 ▶ return '' if $self->{+DNE} && $self->{+DNE} eq 'got';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"dne"} and $self->{"dne"} eq "got" 21 300 321
Condition100%3/3
$self->{"dne"} and $self->{"dne"} eq "got"
!ll&&!rl&&r
299121
MC/DC100%2/2
$self->{"dne"} and $self->{"dne"} eq "got"
$self->{"dne"} $self->{"dne"} eq "got"
Truth table100%3/3
A and B
A= $self->{"dne"}B= $self->{"dne"} eq "got"
ABresult
0X0
100
111
251  
252 300 my @lines = $check->got_lines($self->{+GOT});
253 300 ▶ return '' unless @lines;
Branch: 1 branch
BranchTrueFalseTotal
unless @lines 295 5 300
254  
255 5 return join ', ' => @lines;
256 }
257  
258 234 ▶sub table_rows {
Subroutine table_rows: called CC=4 SCAR=13.9
Pod documented
259 234 my $self = shift;
260  
261 234 my $deltas = $self->filter_visible;
262  
263 234 my @rows;
264 234 for my $set (@$deltas) {
265 332 my ($id, $d) = @$set;
266  
267 332 my @row;
268 332 for my $col (@COLUMN_ORDER) {
269 2005 my $spec = $COLUMNS{$col};
270 2005 my $val = $spec->{value}->($d, $id);
271 2005 ▶ $val = '' unless defined $val;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val 0 2005 2005
272 2005 push @row => $val;
273 }
274  
275 332 push @rows => \@row;
276 }
277  
278 234 return \@rows;
279 }
280  
281 236 ▶sub table {
Subroutine table: called CC=10 SCAR=23.0
Pod documented
282 236 my $self = shift;
283  
284 236 my @diag;
285 236 my $header = $self->table_header;
286 236 my $rows = $self->table_rows;
287  
288 236 my $render_rows = [@$rows];
289 236 ▶ my $max = exists $ENV{TS_MAX_DELTA} ? $ENV{TS_MAX_DELTA} : 25;
Branch: 1 branch
BranchTrueFalseTotal
exists $ENV{'TS_MAX_DELTA'} ? : 3 233 236
290 236 ▶ if ($max && @$render_rows > $max) {
Branch: 1 branch
BranchTrueFalseTotal
if ($max and @$render_rows > $max) 1 235 236
Condition66%2/3
$max and @$render_rows > $max
!ll&&!rl&&r
02351
MC/DC50%1/2
$max and @$render_rows > $max
$max @$render_rows > $max
Truth table66%2/3
A and B
A= $maxB= @$render_rows > $max
ABresult
0X0
100
111
291 1 @$render_rows = map { [@$_] } @{$render_rows}[0 .. ($max - 1)];
292 1 @diag = (
293 "************************************************************",
294 sprintf("* Stopped after %-42.42s *", "$max differences."),
295 "* Set the TS_MAX_DELTA environment var to raise the limit. *",
296 "* Set it to 0 for no limit. *",
297 "************************************************************",
298 );
299 }
300  
301 236 my @dne;
302 236 for my $row (@$render_rows) {
303 340 ▶ my $got = $row->[$COLUMNS{GOT}->{id}] || '';
Condition100%2/2
$$row[$COLUMNS{'GOT'}{'id'}] || ''
l!l
31822
MC/DC100%1/1
$$row[$COLUMNS{'GOT'}{'id'}] || ''
$$row[$COLUMNS{'GOT'}{'id'}]
Truth table100%2/2
A
A= $$row[$COLUMNS{'GOT'}{'id'}]
Aresult
11
00
304 340 ▶ my $chk = $row->[$COLUMNS{CHECK}->{id}] || '';
Condition100%2/2
$$row[$COLUMNS{'CHECK'}{'id'}] || ''
l!l
3346
MC/DC100%1/1
$$row[$COLUMNS{'CHECK'}{'id'}] || ''
$$row[$COLUMNS{'CHECK'}{'id'}]
Truth table100%2/2
A
A= $$row[$COLUMNS{'CHECK'}{'id'}]
Aresult
11
00
305 340 ▶ if ($got eq '<DOES NOT EXIST>') {
Branch: 2 branches
BranchTrueFalseTotal
if ($got eq '<DOES NOT EXIST>') { } 20 320 340
elsif ($chk eq '<DOES NOT EXIST>') { } 15 305 320
306 20 push @dne => "$row->[$COLUMNS{PATH}->{id}]: DOES NOT EXIST";
307 }
308 elsif ($chk eq '<DOES NOT EXIST>') {
309 15 push @dne => "$row->[$COLUMNS{PATH}->{id}]: SHOULD NOT EXIST";
310 }
311 }
312  
313 236 ▶ if (@dne) {
Branch: 1 branch
BranchTrueFalseTotal
if (@dne) 25 211 236
314 25 unshift @dne => '==== Summary of missing/extra items ====';
315 25 push @dne => '== end summary of missing/extra items ==';
316 }
317  
318 my $table_args = {
319 header => $header,
320 collapse => 1,
321 sanitize => 1,
322 mark_tail => 1,
323 236 no_collapse => [grep { $COLUMNS{$COLUMN_ORDER[$_]}->{no_collapse} } 0 .. $#COLUMN_ORDER],
324 };
325  
326 236 my $render = join "\n" => (
327 Test2::Util::Table::table(%$table_args, rows => $render_rows),
328 @dne,
329 @diag,
330 );
331  
332 236 my $table = Test2::EventFacet::Info::Table->new(
333 %$table_args,
334 rows => $rows,
335 as_string => $render,
336 );
337  
338 236 return $table;
339 }
340  
341 228 ▶sub diag { shift->table }
Subroutine diag: called CC=1 SCAR=0.0
Pod undocumented
342  
343 176 1;
344  
345 __END__
« blib/lib/Test2/Tools/Mock.pm ↑ Summary blib/lib/Test2/Hub/Interceptor.pm »