Branch Coverage

blib/lib/Config/GitLike.pm
Criterion Covered Total %
branch 254 308 82.4


line true false branch
100 0 316 unless defined $name
113 0 52 wantarray ? :
131 57 248 if (-f $path)
133 57 0 unless $self->cascade
166 129 166 unless -f $filename and -r $filename
167 0 166 unless open my $fh, '<', $filename
168 1 165 if (my $encoding = $self->encoding)
175 1 165 if ($c =~ /\r\n/) { }
1 328 elsif (not $c =~ /\n/ and $c =~ /\r/) { }
196 181 3 if (ref $ref) { }
203 184 0 if @_ % 2
223 0 184 if grep {$_ eq $filename;} @{$self->config_files;} and not $args{'force'}
226 0 117 if not $c and $args{'silent'}
227 117 67 unless (defined $c)
228 0 117 unless ref $ref
236 67 0 if $self->include and $args{'includes'}
238 3 64 unless $self->is_loaded
245 0 355 unless $self->include and $args{'includes'}
247 355 0 unless lc($def{'section'} || '') eq lc($sec || '')
248 0 0 unless ($def{'subsection'} || '') eq ($subsec || '')
249 0 0 unless lc($def{'name'} || '') eq lc($name || '')
253 0 0 if $args{'depth'} > $self->max_depth
307 11 150 unless $c
310 11 139 $self->compatible ? :
314 11 139 $self->compatible ? :
318 11 139 $self->compatible ? :
329 91 1018 if ($c =~ s/\A[#;].*?$//im) { }
330 688 elsif ($c =~ s/$section_regex//) { }
5 683 elsif ($c =~ s/$key_regex//) { }
533 150 elsif ($c =~ s/$key_value_regex//) { }
141 9 elsif (not length $c) { }
343 72 258 if ($2)
350 0 72 if $check =~ /\\|"/
378 0 5 unless defined $section
392 0 533 unless defined $section
399 533 789 if ($c =~ s/\A([ \t]*[#;].*?)?$//im) { }
57 732 elsif ($c =~ s/\A[\t ]+//im) { }
2 730 elsif ($c =~ s/\A\\\r?\n//im) { }
24 706 elsif ($c =~ s/\A\\\\//im) { }
98 608 elsif ($c =~ s/\A\\(['"])//im) { }
0 608 elsif ($c =~ s/\A\\n//im) { }
0 608 elsif ($c =~ s/\A\\t//im) { }
0 608 elsif ($c =~ s/\A\\b//im) { }
12 596 elsif ($c =~ s/\A"([^"\\]*(?:(?:\\\n|\\[tbn"\\])[^"\\]*)*)"//im) { }
596 0 elsif ($c =~ s/\A([^\t \\\n"]+)//im) { }
493 135 220 unless defined $args{'section'} and defined $args{'name'}
500 207 13 if (not defined $self->origins->{$key} or $self->origins->{$key} eq $args{'origin'}) { }
502 1 206 if ($self->is_multiple($key)) { }
9 197 elsif (exists $self->data->{$key}) { }
519 0 13 if $self->is_multiple($key)
543 14 113 if (defined $args{'as'} and $args{'as'} eq 'bool-or-int')
544 6 8 if ($args{'value'} =~ /^-?[0-9]*\.?[0-9]*[kmg]?$/) { }
8 0 elsif ($args{'value'} =~ /^(?:true|yes|on|-?0*1)$/i or $args{'value'} =~ /^(?:false|no|off|0*)$/i) { }
0 0 elsif (not defined $args{'value'}) { }
560 79 48 unless defined $args{'as'}
561 34 14 if ($args{'as'} =~ /bool/i) { }
14 0 elsif ($args{'as'} =~ /int|num/) { }
562 1 33 unless defined $v
563 16 17 if ($v =~ /^(?:true|yes|on|-?0*1)$/i) { }
15 2 elsif ($v =~ /^(?:false|no|off|0*)$/i) { }
564 9 7 if ($args{'human'}) { }
572 8 7 if ($args{'human'}) { }
584 1 13 unless $v =~ /^-?[0-9]*\.?[0-9]*[kmg]?$/
587 3 10 if ($v =~ s/([kmg])$//)
588 1 2 if $1 eq 'k'
589 2 1 if $1 eq 'm'
590 0 3 if $1 eq 'g'
593 12 1 $args{'as'} eq 'int' ? :
604 0 83 unless $self->is_loaded
608 0 82 unless exists $self->data->{$args{'key'}}
610 12 70 ref $v ? :
611 10 72 if (defined $args{'filter'} and length $args{'filter'})
612 0 10 if ($args{'filter'} eq '!') { }
2 8 elsif ($args{'filter'} =~ s/^!//) { }
619 11 1 if defined $_
649 1 69 unless @v
650 1 68 if @v > 1
668 0 12 wantarray ? :
682 0 28 unless $self->is_loaded
684 0 28 unless defined $args{'key'} and length $args{'key'}
688 33 75 if $key =~ /$args{'key'}/i
691 21 7 if (defined $args{'filter'} and length $args{'filter'})
692 1 20 if ($args{'filter'} eq '!') { }
10 10 elsif ($args{'filter'} =~ s/^!//) { }
697 7 5 ref $results{$_} ? :
699 7 5 if (not @values) { }
703 2 3 @values > 1 ? :
709 8 2 ref $results{$_} ? :
710 18 0 if defined $_
711 3 7 if (not @values) { }
715 5 2 @values > 1 ? :
727 0 28 wantarray ? :
740 1 570 unless $section
750 0 5 unless $self->is_loaded
752 2 3 if wantarray
757 9 0 if (defined $self->data->{$key}) { }
761 0 9 if ($self->is_multiple($key)) { }
773 0 9 if (not defined wantarray) { }
781 3 0 if defined wantarray
793 7 25 if ($args{'section'} =~ /^(.*?)\.(.*)$/) { }
796 5 2 unless $args{'bare'}
801 25 0 unless $args{'bare'}
814 4 79 $args{'value'} =~ /(^\s|;|#|\s$)/ ? :
820 72 11 unless $args{'bare'}
832 4 1025 if ($key =~ s/\.["'](.*)["']$//) { }
866 4 99 unless defined $section
869 7 92 if $self->_invalid_variable_name($name)
872 2 90 if $self->_invalid_section_name($section)
878 5 85 if (defined $subsection)
888 20 70 if defined $args{'value'} and defined $args{'as'}
896 85 4 unless defined $args{'multiple'}
899 5 84 defined $unescaped_subsection ? :
904 5 84 defined $subsection ? :
920 277 204 unless $got{'section'} eq $cmp_section
922 58 146 unless defined $got{'name'}
926 28 118 if (lc $name eq lc $got{'name'})
927 8 20 if (defined $args{'filter'} and length $args{'filter'}) { }
932 0 8 if ($filter eq '!') { }
3 5 elsif ($filter =~ s/^!//) { }
3 2 elsif ($got{'value'} =~ /$filter/i) { }
936 1 2 unless $got{'value'} =~ /$filter/i
948 24 122 if $matched
956 1 88 if @replace > 1 and not $args{'multiple'}
960 13 5 if @replace and $args{'value'} and not $args{'replace_all'}
962 83 5 if (defined $args{'value'}) { }
963 11 72 if (@replace and !$args{'multiple'} || $args{'filter'} || $args{'replace_all'}) { }
42 30 elsif (defined $new) { }
1016 1 4 unless @replace
1053 4 2 $newline > $bracket ? :
1088 7 92 if ($self->compatible) { }
1100 3 89 if ($self->compatible) { }
1114 0 94 if $newlines ne "\n"
1121 1 469 if defined $readlink
1127 0 94 unless sysopen my $fh, "$filename.lock", 193
1129 1 93 if (my $encoding = $self->encoding)
1136 0 94 unless rename "$filename.lock", $filename
1150 0 5 unless defined $args{'from'}
1154 0 5 unless defined $c
1167 5 27 if @replace and not defined $got{'name'}
1169 14 18 if (lc $got{'section'} eq lc $args{'from'}) { }
1170 7 7 if (defined $got{'name'}) { }
1175 4 3 if ($prev_matched and not defined $args{'to'})
1189 1 2 if @replace and $prev_matched and not defined $args{'to'}
1203 1 3 if @replace and $prev_matched and not defined $args{'to'}
1211 1 4 unless @replace
1222 2 2 defined $args{'to'} ? :
1232 2 5 !defined($args{'to'}) && $header->{'section_is_last'} ? :
1249 0 2 unless $args{'section'}
1266 0 4 unless my $filename = $args{'filename'}
1267 0 4 unless defined $args{'comment'}
1270 1 3 $args{'indented'} ? :
1271 1 3 $args{'semicolon'} ? :
1273 4 0 unless $comment =~ /\n\z/
1276 1 3 unless defined $c