Branch Coverage

blib/lib/Ledger/Parser.pm
Criterion Covered Total %
branch 80 100 80.0


line true false branch
82 0 1 unless $attrs{'input_date_format'} =~ m[\A(YYYY/MM/DD|YYYY/DD/MM)\z]
90 0 23 unless $str =~ /\A(?:$RE_date)\z/
94 23 0 if ($$self{'input_date_format'} eq 'YYYY/MM/DD') { }
108 1 22 if ($@)
114 0 27 unless $str =~ /\A(?:$RE_amount)\z/
119 1 26 if ($commodity1 and $commodity2)
123 14 12 if $minsign
124 4 22 $commodity1 ? :
146 0 18 if $$t_line[2]
150 18 46 if $linum++ > @$parsed - 1
153 41 5 if ($type eq 'P') { }
5 0 elsif ($type eq 'TC') { }
155 1 39 $oparen eq '[' ? :
1 40 $oparen eq '(' ? :
26 15 $$line[10] ? :
26 15 $$line[10] ? :
169 1 4 if (@{$$tx{'postings'};}) { }
183 1 17 unless $num_postings
184 0 17 if ($num_postings == 1 and not defined !$$tx{'postings'}[0]{'amount'})
192 15 26 unless (defined $$p{'amount'})
198 13 4 if $num_nulls == 1
199 1 3 if ($num_nulls)
203 1 1 $_ ? :
2 1 if $bals{$_} != 0
216 9 0 @{$$self{'_include_stack'};} ? :
228 0 19 if (@{$$self{'_include_stack'};})
235 0 19 unless my $abs_path = Cwd::abs_path($path)
237 0 19 if grep {$_ eq $abs_path;} @{$$self{'_include_stack'};}
245 0 10 unless @{$$self{'_include_stack'};}
257 0 19 unless open my $fh, '<', $filename
268 0 19 unless $$res[0] == 200
296 17 50 if ($in_tx and !($line =~ /\S/) || $line =~ /^\S/)
298 0 14 if ($$parse_tx[0] != 200)
306 25 100 unless ($line =~ /\S/)
315 23 77 if ($line =~ /^\d/)
316 0 23 unless $line =~ /^($re_date) # 1) actual date (?: = ($re_date))? # 2) effective date (?: (\s+) ([!*]) )? # 3) ws 4) state (?: (\s+) \(([^\)]+)\) )? # 5) ws 6) code (\s+) (\S.*?) # 7) ws 8) desc (?: (\s{2,}) ;(\S.+?) )? # 9) ws 10) comment (\R?)\z # 11) nl /x
328 1 22 if ($$parse_date[0] != 200)
333 0 22 if ($2)
335 0 0 if ($$parse_edate[0] != 200)
347 26 51 if ($line =~ /^([;#%|*])(.*?)(\R?)\z/)
353 5 46 if ($in_tx and $line =~ /^(\s+);(.*?)(\R?)\z/)
359 45 1 if ($in_tx and $line =~ /^\s/)
360 1 44 unless $line =~ /^(\s+) # 1) ws1 (\[|\()? # 2) oparen ($re_account) # 3) account (\]|\))? # 4) cparen (?: (\s{2,})($re_amount) )? # 5) ws2 6) amount (?: (\s*) ;(.*?))? # 7) ws 8) note (\R?)\z # 9) nl /x
371 2 1 unless (not $oparen || $cparen or $oparen eq '[' and $cparen eq ']' or $oparen eq '(' and $cparen eq ')')
378 27 15 if (defined $6)
380 1 26 if ($$parse_amount[0] != 200)
394 9 1 if (@$res)
395 1 8 unless $$res[-1][-1] =~ /\R\z/
399 1 9 if ($in_tx)
401 0 1 if ($$parse_tx[0] != 200)