Branch Coverage

blib/lib/Ledger/Parser.pm
Criterion Covered Total %
branch 96 116 82.7


line true false branch
83 0 1 unless $attrs{'input_date_format'} =~ m[\A(YYYY/MM/DD|YYYY/DD/MM)\z]
91 0 26 unless $str =~ /\A(?:$RE_date)\z/
95 26 0 if ($self->{'input_date_format'} eq 'YYYY/MM/DD') { }
109 1 25 if ($@)
115 0 32 unless $str =~ /\A(?:$RE_amount)\z/
120 1 31 if ($commodity1 and $commodity2)
124 16 15 if $minsign
125 4 27 $commodity1 ? :
147 1 19 if $t_line->[2]
151 20 51 if $linum++ > @$parsed - 1
154 46 5 if ($type eq 'P') { }
5 0 elsif ($type eq 'TC') { }
156 1 44 $oparen eq '[' ? :
1 45 $oparen eq '(' ? :
31 15 $line->[10] ? :
31 15 $line->[10] ? :
170 1 4 if (@{$tx->{'postings'};}) { }
184 1 19 unless $num_postings
185 0 19 if ($num_postings == 1 and not defined !$tx->{'postings'}[0]{'amount'})
193 15 31 unless (defined $p->{'amount'})
199 13 6 if $num_nulls == 1
200 1 5 if ($num_nulls)
206 1 1 $_ ? :
2 3 if $bals{$_} != 0
217 9 0 @{$self->{'_include_stack'};} ? :
229 0 21 if (@{$self->{'_include_stack'};})
236 0 21 unless my $abs_path = Cwd::abs_path($path)
238 0 21 if grep {$_ eq $abs_path;} @{$$self{'_include_stack'};}
246 0 12 unless @{$self->{'_include_stack'};}
258 0 21 unless open my $fh, '<', $filename
269 0 21 unless $res->[0] == 200
297 17 55 if ($in_tx and !($line =~ /\S/) || $line =~ /^\S/)
299 0 14 if ($parse_tx->[0] != 200)
307 29 116 unless ($line =~ /\S/)
316 25 91 if ($line =~ /^\d/)
317 0 25 unless $line =~ /^($re_date) # 1) actual date (?: = ($re_date))? # 2) effective date (?: (\s+) ([!*]) )? # 3) ws1 4) state (?: (\s+) \(([^\)]+)\) )? # 5) ws2 6) code (\s+) (\S.*?) # 7) ws3 8) desc (?: (\s{2,}) ;(\S.+?) )? # 9) ws4 10) comment (\R?)\z # 11) nl /x
329 1 24 if ($parse_date->[0] != 200)
334 1 23 if ($2)
336 0 1 if ($parse_edate->[0] != 200)
348 35 56 if ($line =~ /^([;#%|*])(.*?)(\R?)\z/)
354 5 51 if ($in_tx and $line =~ /^(\s+);(.*?)(\R?)\z/)
360 50 1 if ($in_tx and $line =~ /^\s/)
361 1 49 unless $line =~ /^(\s+) # 1) ws1 (\[|\()? # 2) oparen ($re_account) # 3) account (\]|\))? # 4) cparen (?: (\s{2,})($re_amount) )? # 5) ws2 6) amount (?: (\s*) ;(.*?))? # 7) ws3 8) comment (\R?)\z # 9) nl /x
372 2 1 unless (not $oparen || $cparen or $oparen eq '[' and $cparen eq ']' or $oparen eq '(' and $cparen eq ')')
379 32 15 if (defined $6)
381 1 31 if ($parse_amount->[0] != 200)
394 3 9 if ($in_tx)
396 0 3 if ($parse_tx->[0] != 200)
416 26 89 if ($type eq 'B') { }
17 72 elsif ($type eq 'T') { }
30 42 elsif ($type eq 'C') { }
5 37 elsif ($type eq 'TC') { }
37 0 elsif ($type eq 'P') { }
419 1 16 length $line->[2] ? :
0 17 length $line->[6] ? :
0 17 length $line->[10] ? :
439 24 13 length $line->[6] ? :
2 35 length $line->[8] ? :