SQL/Abstract/Test.pm

filter: Statementstmt 69.1% 110 / 159 Branchbran 65.7% 46 / 70 Conditioncond 47.4% 28 / 59 MC/DCmcdc 32.4% 12 / 37 Subroutinesub 72.7% 16 / 22 Podpod 66.6% 6 / 9 totaltotal 61.2% 218 / 356 CC 55 SCAR 30.6
CC
55
Cov
64%
_sql_differ_diag
56.0
_eq_sql
33.9
__ANON__
12.0
CRAP 21.3
« SQL/Abstract/Tree.pm ↑ Summary SQL/Abstract/Formatter.pm »
1 package SQL::Abstract::Test; # see doc at end of file
2  
3 20 our $VERSION = '2.000003';
4 20 ▶$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
Branch: 1 branch
BranchTrueFalseTotal
if $VERSION =~ /_/ 0 20 20
5  
6 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 ▶use base qw(Test::Builder::Module);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 20 ▶use Test::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 20 ▶use Test::Deep ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11 20 ▶use SQL::Abstract::Tree;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 {
14 20 my $class;
15 20 ▶ if ($class = $ENV{SQL_ABSTRACT_TEST_AGAINST}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class = $ENV{"SQL_ABSTRACT_TEST_AGAINST"}) 0 20 20
16 0 my $mod = join('/', split '::', $class).".pm";
17 0 require $mod;
18 0 ▶ eval qq{sub SQL::Abstract () { "\Q${class}\E" }; 1}
Branch: 1 branch
BranchTrueFalseTotal
eval qq[sub SQL::Abstract () { "\Q$class\E" }; 1] or die "Failed to create const sub for ${class}: $@" 0 0 0
19 or die "Failed to create const sub for ${class}: $@";
20 }
21 20 ▶ if ($ENV{SQL_ABSTRACT_TEST_EXPAND_STABILITY}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"SQL_ABSTRACT_TEST_EXPAND_STABILITY"}) 0 20 20
22 0 ▶ $class ||= do { require SQL::Abstract; 'SQL::Abstract' };
Condition0%0/3
$class ||= do { require SQL::Abstract; "SQL::Abstract" }
l!l&&r!l&&!r
000
MC/DC0%0/2
$class ||= do { require SQL::Abstract; "SQL::Abstract" }
$class do { require SQL::Abstract; "SQL::Abstract" }
Truth table0%0/3
A ||= B
A= $classB= do { require SQL::Abstract; "SQL::Abstract" }
ABresult
1X1
011
000
23 0 my $orig = $class->can('expand_expr');
24 0 require Data::Dumper::Concise;
25 0 ▶ my $wrapped = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
26 0 my ($self, @args) = @_;
27 0 my $e1 = $self->$orig(@args);
28 0 ▶ return $e1 if our $Stab_Check_Rec;
Branch: 1 branch
BranchTrueFalseTotal
if our $Stab_Check_Rec 0 0 0
29 0 local $Stab_Check_Rec = 1;
30 0 my $e2 = $self->$orig($e1);
31 0 my ($d1, $d2) = map Data::Dumper::Concise::Dumper($_), $e1, $e2;
32 (our $tb)->is_eq(
33 $d2, $d1,
34 'expand_expr stability ok'
35 0 ▶ ) or do {
Branch: 1 branch
BranchTrueFalseTotal
our $tb->is_eq($d2, $d1, "expand_expr stability ok") or do { require Path::Tiny; "Path::Tiny"->new("e1")->spew($d1); "Path::Tiny"->new("e2")->spew($d2); system "diff -u e1 e2 1>&2"; die "Differences between e1 and e2, bailing out" } 0 0 0
36 0 require Path::Tiny;
37 0 Path::Tiny->new('e1')->spew($d1);
38 0 Path::Tiny->new('e2')->spew($d2);
39 0 system('diff -u e1 e2 1>&2');
40 0 die "Differences between e1 and e2, bailing out";
41 };
42 0 return $e1;
43 0 };
44 20 ▶ no strict 'refs'; no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
45 0 *{"${class}::expand_expr"} = $wrapped;
46 }
47 }
48  
49 20 our @EXPORT_OK = qw(
50 is_same_sql_bind is_same_sql is_same_bind
51 eq_sql_bind eq_sql eq_bind dumper diag_where
52 $case_sensitive $sql_differ
53 );
54  
55 20 my $sqlat = SQL::Abstract::Tree->new;
56  
57 20 our $case_sensitive = 0;
58 20 our $parenthesis_significant = 0;
59 20 our $order_by_asc_significant = 0;
60  
61 20 our $sql_differ; # keeps track of differing portion between SQLs
62 20 our $tb; # not documented, but someone might be overriding it anyway
63  
64 651 ▶sub _unpack_arrayrefref {
Subroutine _unpack_arrayrefref: called CC=4 SCAR=13.9
65  
66 651 my @args;
67 651 for (1,2) {
68 1302 my $chunk = shift @_;
69  
70 1302 ▶ if (ref $chunk eq 'REF' and ref $$chunk eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $chunk eq 'REF' and ref $$chunk eq 'ARRAY') { } 3 1299 1302
Condition66%2/3
ref $chunk eq "REF" and ref $$chunk eq "ARRAY"
!ll&&!rl&&r
129903
MC/DC50%1/2
ref $chunk eq "REF" and ref $$chunk eq "ARRAY"
ref $chunk eq "REF" ref $$chunk eq "ARRAY"
Truth table66%2/3
A and B
A= ref $chunk eq "REF"B= ref $$chunk eq "ARRAY"
ABresult
0X0
100
111
71 3 my ($sql, @bind) = @$$chunk;
72 3 push @args, ($sql, \@bind);
73 }
74 else {
75 1299 push @args, $chunk, shift @_;
76 }
77  
78 }
79  
80 # maybe $msg and ... stuff
81 651 push @args, @_;
82  
83 651 @args;
84 }
85  
86 647 ▶sub is_same_sql_bind {
Subroutine is_same_sql_bind: called CC=5 SCAR=18.9
Pod documented
87 647 my ($sql1, $bind_ref1, $sql2, $bind_ref2, $msg) = &_unpack_arrayrefref;
88  
89 # compare
90 647 my $same_sql = eq_sql($sql1, $sql2);
91 647 my $same_bind = eq_bind($bind_ref1, $bind_ref2);
92  
93 # call Test::Builder::ok
94 647 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition33%1/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
06470
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table33%1/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
95 647 ▶ my $ret = $tb->ok($same_sql && $same_bind, $msg);
Condition33%1/3
$same_sql && $same_bind
!ll&&!rl&&r
00647
MC/DC0%0/2
$same_sql && $same_bind
$same_sql $same_bind
Truth table33%1/3
A && B
A= $same_sqlB= $same_bind
ABresult
0X0
100
111
96  
97 # add debugging info
98 647 ▶ if (!$same_sql) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($same_sql) 0 647 647
99 0 _sql_differ_diag($sql1, $sql2);
100 }
101 647 ▶ if (!$same_bind) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($same_bind) 0 647 647
102 0 _bind_differ_diag($bind_ref1, $bind_ref2);
103 }
104  
105 # pass ok() result further
106 647 return $ret;
107 }
108  
109 68 ▶sub is_same_sql {
Subroutine is_same_sql: called CC=3 SCAR=12.0
Pod documented
110 68 my ($sql1, $sql2, $msg) = @_;
111  
112 # compare
113 68 my $same_sql = eq_sql($sql1, $sql2);
114  
115 # call Test::Builder::ok
116 68 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition33%1/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
0680
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table33%1/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
117 68 my $ret = $tb->ok($same_sql, $msg);
118  
119 # add debugging info
120 68 ▶ if (!$same_sql) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($same_sql) 0 68 68
121 0 _sql_differ_diag($sql1, $sql2);
122 }
123  
124 # pass ok() result further
125 68 return $ret;
126 }
127  
128 1 ▶sub is_same_bind {
Subroutine is_same_bind: called CC=3 SCAR=12.0
Pod documented
129 1 my ($bind_ref1, $bind_ref2, $msg) = @_;
130  
131 # compare
132 1 my $same_bind = eq_bind($bind_ref1, $bind_ref2);
133  
134 # call Test::Builder::ok
135 1 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition33%1/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
010
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table33%1/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
136 1 my $ret = $tb->ok($same_bind, $msg);
137  
138 # add debugging info
139 1 ▶ if (!$same_bind) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($same_bind) 0 1 1
140 0 _bind_differ_diag($bind_ref1, $bind_ref2);
141 }
142  
143 # pass ok() result further
144 1 return $ret;
145 }
146  
147 0 ▶sub dumper {
Subroutine dumper: not called CC=1 SCAR=6.9
Pod undocumented
148 # FIXME
149 # if we save the instance, we will end up with $VARx references
150 # no time to figure out how to avoid this (Deepcopy is *not* an option)
151 0 require Data::Dumper;
152 0 Data::Dumper->new([])->Terse(1)->Indent(1)->Useqq(1)->Deparse(1)->Quotekeys(0)->Sortkeys(1)->Maxdepth(0)
153 ->Values([@_])->Dump;
154 }
155  
156 0 ▶sub diag_where{
Subroutine diag_where: not called CC=2 SCAR=17.9
Pod undocumented
157 0 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition0%0/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
000
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table0%0/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
158 0 $tb->diag("Search term:\n" . &dumper);
159 }
160  
161 0 ▶sub _sql_differ_diag {
Subroutine _sql_differ_diag: not called CC=7 SCAR=40.3
162 0 ▶ my $sql1 = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
163 0 ▶ my $sql2 = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
164  
165 0 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition0%0/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
000
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table0%0/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
166  
167 0 ▶ if (my $profile = $ENV{SQL_ABSTRACT_TEST_TREE_PROFILE}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $profile = $ENV{"SQL_ABSTRACT_TEST_TREE_PROFILE"}) 0 0 0
168 0 my $sqlat = SQL::Abstract::Tree->new(profile => $profile);
169 0 $_ = $sqlat->format($_) for ($sql1, $sql2);
170 }
171  
172 0 ▶ $tb->${\($tb->in_todo ? 'note' : 'diag')} (
Branch: 1 branch
BranchTrueFalseTotal
$tb->in_todo ? : 0 0 0
173 "SQL expressions differ\n"
174 ." got: $sql1\n"
175 ."want: $sql2\n"
176 ."\nmismatch around\n$sql_differ\n"
177 );
178 }
179  
180 0 ▶sub _bind_differ_diag {
Subroutine _bind_differ_diag: not called CC=3 SCAR=24.8
181 0 my ($bind_ref1, $bind_ref2) = @_;
182  
183 0 ▶ my $tb = $tb || __PACKAGE__->builder;
Condition0%0/3
$SQL::Abstract::Test::tb || __PACKAGE__->builder
l!l&&r!l&&!r
000
MC/DC0%0/2
$SQL::Abstract::Test::tb || __PACKAGE__->builder
$SQL::Abstract::Test::tb __PACKAGE__->builder
Truth table0%0/3
A || B
A= $SQL::Abstract::Test::tbB= __PACKAGE__->builder
ABresult
1X1
011
000
184 0 ▶ $tb->${\($tb->in_todo ? 'note' : 'diag')} (
Branch: 1 branch
BranchTrueFalseTotal
$tb->in_todo ? : 0 0 0
185 "BIND values differ " . dumper({ got => $bind_ref1, want => $bind_ref2 })
186 );
187 }
188  
189 4 ▶sub eq_sql_bind {
Subroutine eq_sql_bind: called CC=2 SCAR=6.9
Pod documented
190 4 my ($sql1, $bind_ref1, $sql2, $bind_ref2) = &_unpack_arrayrefref;
191  
192 4 ▶ return eq_sql($sql1, $sql2) && eq_bind($bind_ref1, $bind_ref2);
Condition100%3/3
eq_sql($sql1, $sql2) && eq_bind($bind_ref1, $bind_ref2)
!ll&&!rl&&r
112
MC/DC100%2/2
eq_sql($sql1, $sql2) && eq_bind($bind_ref1, $bind_ref2)
eq_sql($sql1, $sql2) eq_bind($bind_ref1, $bind_ref2)
Truth table100%3/3
A && B
A= eq_sql($sql1, $sql2)B= eq_bind($bind_ref1, $bind_ref2)
ABresult
0X0
100
111
193 }
194  
195  
196 780 ▶sub eq_bind { goto &Test::Deep::eq_deeply };
Subroutine eq_bind: called CC=1 SCAR=0.0
Pod documented
197  
198 2357 ▶sub eq_sql {
Subroutine eq_sql: called CC=2 SCAR=6.9
Pod documented
199 2357 my ($sql1, $sql2) = @_;
200  
201 # parse
202 2357 my $tree1 = $sqlat->parse($sql1);
203 2357 my $tree2 = $sqlat->parse($sql2);
204  
205 2357 undef $sql_differ;
206 2357 ▶ return 1 if _eq_sql($tree1, $tree2);
Branch: 1 branch
BranchTrueFalseTotal
if _eq_sql($tree1, $tree2) 1084 1273 2357
207 }
208  
209 43053 ▶sub _eq_sql {
Subroutine _eq_sql: called CC=31 SCAR=35.2
210 43053 my ($left, $right) = @_;
211  
212 # one is defined the other not
213 43053 ▶ if ((defined $left) xor (defined $right)) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $left xor defined $right) { } 21 43032 43053
elsif (not defined $left) { } 1231 41801 43032
elsif (@$left == 0 and @$right == 0) { } 34 83533 83567
Condition100%4/4
defined $left xor defined $right
l&&rl&&!r!l&&r!l&&!r
418019121231
MC/DC100%2/2
defined $left xor defined $right
defined $left defined $right
Truth table100%4/4
A xor B
A= defined $leftB= defined $right
ABresult
110
101
011
000
214 21 ▶ $sql_differ = sprintf ("[%s] != [%s]\n", map { defined $_ ? $sqlat->unparse($_) : 'N/A' } ($left, $right) );
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 21 21 42
215 21 return 0;
216 }
217  
218 # one is undefined, then so is the other
219 elsif (not defined $left) {
220 1231 return 1;
221 }
222  
223 # both are empty
224 ▶ elsif (@$left == 0 and @$right == 0) {
Condition100%3/3
@$left == 0 and @$right == 0
!ll&&!rl&&r
41766134
MC/DC100%2/2
@$left == 0 and @$right == 0
@$left == 0 @$right == 0
Truth table100%3/3
A and B
A= @$left == 0B= @$right == 0
ABresult
0X0
100
111
225 34 return 1;
226 }
227  
228 # one is empty
229 41767 ▶ if (@$left == 0 or @$right == 0) {
Branch: 3 branches
BranchTrueFalseTotal
if (@$left == 0 or @$right == 0) { } 9 41758 41767
elsif (ref $left->[0] xor ref $right->[0]) { } 0 41758 41758
elsif (ref $left->[0]) { } 15577 26181 41758
Condition100%3/3
@$left == 0 or @$right == 0
l!l&&r!l&&!r
1841758
MC/DC100%2/2
@$left == 0 or @$right == 0
@$left == 0 @$right == 0
Truth table100%3/3
A or B
A= @$left == 0B= @$right == 0
ABresult
1X1
011
000
230 9 ▶ $sql_differ = sprintf ("left: %s\nright: %s\n", map { @$_ ? $sqlat->unparse($_) : 'N/A'} ($left, $right) );
Branch: 1 branch
BranchTrueFalseTotal
@$_ ? : 9 9 18
231 9 return 0;
232 }
233  
234 # one is a list, the other is an op with a list
235 ▶ elsif (ref $left->[0] xor ref $right->[0]) {
Condition50%2/4
ref $left->[0] xor ref $right->[0]
l&&rl&&!r!l&&r!l&&!r
155770026181
MC/DC0%0/2
ref $left->[0] xor ref $right->[0]
ref $left->[0] ref $right->[0]
Truth table50%2/4
A xor B
A= ref $left->[0]B= ref $right->[0]
ABresult
110
101
011
000
236 $sql_differ = sprintf ("[%s] != [%s]\nleft: %s\nright: %s\n", map
237 0 ▶ { ref $_ ? $sqlat->unparse($_) : $_ }
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 0 0 0
238 ($left->[0], $right->[0], $left, $right)
239 );
240 0 return 0;
241 }
242  
243 # both are lists
244 elsif (ref $left->[0]) {
245 15577 ▶ for (my $i = 0; $i <= $#$left or $i <= $#$right; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $left->$#* or $i <= $right->$#*) 24981 11232 36213
Condition100%3/3
$i <= $left->$#* or $i <= $right->$#*
l!l&&r!l&&!r
249691211232
MC/DC100%2/2
$i <= $left->$#* or $i <= $right->$#*
$i <= $left->$#* $i <= $right->$#*
Truth table100%3/3
A or B
A= $i <= $left->$#*B= $i <= $right->$#*
ABresult
1X1
011
000
246 24981 ▶ if (not _eq_sql ($left->[$i], $right->[$i]) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_eq_sql($left->[$i], $right->[$i])) 4345 20636 24981
247 4345 ▶ if (! $sql_differ or $sql_differ !~ /left\:\s .+ right:\s/xs) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($SQL::Abstract::Test::sql_differ and $SQL::Abstract::Test::sql_differ =~ /left\:\s .+ right:\s/sx) 886 3459 4345
Condition66%2/3
$SQL::Abstract::Test::sql_differ and $SQL::Abstract::Test::sql_differ =~ /left\:\s .+ right:\s/sx
!ll&&!rl&&r
08863459
MC/DC50%1/2
$SQL::Abstract::Test::sql_differ and $SQL::Abstract::Test::sql_differ =~ /left\:\s .+ right:\s/sx
$SQL::Abstract::Test::sql_differ $SQL::Abstract::Test::sql_differ =~ /left\:\s .+ right:\s/sx
Truth table66%2/3
A and B
A= $SQL::Abstract::Test::sql_differB= $SQL::Abstract::Test::sql_differ =~ /left\:\s .+ right:\s/sx
ABresult
0X0
100
111
248 886 ▶ $sql_differ ||= '';
Condition50%1/2
$SQL::Abstract::Test::sql_differ ||= ""
l!l
8860
MC/DC0%0/1
$SQL::Abstract::Test::sql_differ ||= ""
$SQL::Abstract::Test::sql_differ
Truth table50%1/2
A
A= $SQL::Abstract::Test::sql_differ
Aresult
11
00
249 886 ▶ $sql_differ .= "\n" unless $sql_differ =~ /\n\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless $SQL::Abstract::Test::sql_differ =~ /\n\z/ 0 886 886
250 886 $sql_differ .= sprintf ("left: %s\nright: %s\n", map { $sqlat->unparse($_) } ($left, $right) );
251 }
252 4345 return 0;
253 }
254 }
255 11232 return 1;
256 }
257  
258 # both are ops
259 else {
260  
261 # unroll parenthesis if possible/allowed
262 26181 ▶ unless ($parenthesis_significant) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($SQL::Abstract::Test::parenthesis_significant) 25924 257 26181
263 25924 $sqlat->_parenthesis_unroll($_) for $left, $right;
264 }
265  
266 # unroll ASC order by's
267 26181 ▶ unless ($order_by_asc_significant) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($SQL::Abstract::Test::order_by_asc_significant) 26163 18 26181
268 26163 $sqlat->_strip_asc_from_order_by($_) for $left, $right;
269 }
270  
271 26181 ▶ if ($left->[0] ne $right->[0]) {
Branch: 2 branches
BranchTrueFalseTotal
if ($left->[0] ne $right->[0]) { } 378 25803 26181
elsif ($left->[0] eq '-LITERAL') { } 10088 15715 25803
272 378 $sql_differ = sprintf "OP [$left->[0]] != [$right->[0]] in\nleft: %s\nright: %s\n",
273 $sqlat->unparse($left),
274 $sqlat->unparse($right)
275 ;
276 378 return 0;
277 }
278  
279 # literals have a different arg-sig
280 elsif ($left->[0] eq '-LITERAL') {
281 10088 (my $l = " $left->[1][0] " ) =~ s/\s+/ /g;
282 10088 (my $r = " $right->[1][0] ") =~ s/\s+/ /g;
283 10088 ▶ my $eq = $case_sensitive ? $l eq $r : uc($l) eq uc($r);
Branch: 1 branch
BranchTrueFalseTotal
$SQL::Abstract::Test::case_sensitive ? : 0 10088 10088
284 10088 ▶ $sql_differ = "[$l] != [$r]\n" if not $eq;
Branch: 1 branch
BranchTrueFalseTotal
unless $eq 865 9223 10088
285 10088 return $eq;
286 }
287  
288 # if operators are identical, compare operands
289 else {
290 15715 my $eq = _eq_sql($left->[1], $right->[1]);
291 0 ▶ $sql_differ ||= sprintf ("left: %s\nright: %s\n", map { $sqlat->unparse($_) } ($left, $right) ) if not $eq;
Branch: 1 branch
BranchTrueFalseTotal
unless $eq 3072 12643 15715
Condition33%1/3
$SQL::Abstract::Test::sql_differ ||= sprintf("left: %s\nright: %s\n", map({$sqlat->unparse($_);} $left, $right))
l!l&&r!l&&!r
307200
MC/DC0%0/2
$SQL::Abstract::Test::sql_differ ||= sprintf("left: %s\nright: %s\n", map({$sqlat->unparse($_);} $left, $right))
$SQL::Abstract::Test::sql_differ sprintf("left: %s\nright: %s\n", map({$sqlat->unparse($_);} $left, $right))
Truth table33%1/3
A ||= B
A= $SQL::Abstract::Test::sql_differB= sprintf("left: %s\nright: %s\n", map({$sqlat->unparse($_);} $left, $right))
ABresult
1X1
011
000
292 15715 return $eq;
293 }
294 }
295 }
296  
297 0 ▶sub parse { $sqlat->parse(@_) }
Subroutine parse: not called CC=1 SCAR=6.9
Pod undocumented
298 20 1;
299  
300  
301 __END__
« SQL/Abstract/Tree.pm ↑ Summary SQL/Abstract/Formatter.pm »