Branch Coverage

blib/lib/Perl6/Form.pm
Criterion Covered Total %
branch 158 542 29.1


line true false branch
7 0 0 if (not ref $_ and /^[:\$&%\@]?(\w+)$/ and exists $EXPORT{$1} || exists $EXPORT_TAGS{$1})
2 0 unless @exports
19 0 0 if not defined $_[0] or length $_[0] == 0
24 0 0 $_[0] ? :
28 0 0 if ref $_[0] eq 'Regexp'
29 0 0 $_[0] ? :
35 0 0 unless $type eq 'CODE'
47 0 0 unless ref $newval eq 'ARRAY'
49 0 0 if length $_ != 1
58 0 0 unless $_[0] =~ /^(across|down|balanced|tabular)$/
65 0 0 unless int $_[0] eq $_[0] and $_[0] > 0
73 0 0 if (not defined $val) { }
0 0 elsif (not $type) { }
75 0 0 unless ref $val eq 'ARRAY'
85 0 0 if (not defined $vals) { }
0 0 elsif (not $type and $vals eq 'minimal') { }
0 0 elsif (not $type) { }
0 0 elsif ($type eq 'HASH') { }
90 0 0 unless defined $vals->{'max'}
94 0 0 unless ref $vals eq 'HASH' and not grep({int $vals->{$_} ne $vals->{$_};} 'min', 'max')
118 0 0 unless defined $format
123 0 0 unless $opt->{'page'}{'length'} == $unlimited
130 0 0 unless (defined $val)
133 0 0 unless (ref $val)
136 0 0 if (ref $val eq 'CODE')
139 0 0 if (ref $val eq 'HASH')
144 0 0 if (not ref $val->{$_}) { }
0 0 elsif (ref $val->{$_} ne 'CODE') { }
185 0 0 unless $type =~ /^(ARRAY|HASH)$/
188 0 0 if ($type eq 'ARRAY') { }
189 0 0 if @$spec % 2
201 0 0 ref $fld eq 'CODE' ? :
234 0 0 exists $lconv->{'decimal_point'} ? :
235 0 0 exists $lconv->{'thousands_sep'} ? :
236 0 0 exists $lconv->{'grouping'} ? :
251 0 0 unless $std
254 0 0 if (@bad and $croak) { }
0 0 elsif (@bad) { }
264 0 8 if $len < 0
276 0 4 unless $val{'precropped'}
279 4 0 unless $val{'stretch'}
284 0 4 unless $val{'precropped'}
286 4 0 unless $val{'stretch'}
302 0 0 unless ($val{'last'})
305 0 0 $rem-- > 0 ? :
313 0 0 length $_[0] ? :
342 15 7 $integral ? :
347 2 20 if ($missing > 0)
349 0 22 if $whole =~ /^0+/
350 0 22 if $places =~ /0+$/
351 22 0 $whole =~ /([,.' ])/ ? :
353 22 0 if ($comma)
354 22 0 $whole =~ /[,.' ](\]+|>+)\z/ ? :
0 22 $whole =~ /,(?:\]{2},\]{3}|>{2},>{3})\z/ ? :
358 8 14 if (defined $setplaces) { }
365 0 22 if $checkplaces and $places != $checkplaces
373 0 22 if $opts->{'locale'}
377 0 22 if $orig =~ /^\s*$/
378 15 7 if $point ne '.'
380 0 22 if (not $orig =~ /^\s*-/ or $orig == -$orig)
386 15 7 if ($integral) { }
396 0 22 if ($fail) { }
400 22 0 if ($grouping)
403 22 0 if ($group)
406 0 22 if @groups
410 20 0 $w ? :
4 18 if (length $w > $width or not $val{'stretch'} and ($w ? length $w : 0) + length($pre) > $whole) { }
414 14 4 $integral ? :
415 18 0 unless $orig =~ /\.\d\{$places,\}[1-9]/
417 14 4 if ($integral and $str < 0)
418 2 12 if ($pre =~ /[(]/ or $post =~ /[)]/) { }
426 0 18 if ($val{'pre'} =~ /^0+$/)
431 4 14 unless ($integral)
437 14 4 if ($integral) { }
0 4 elsif ($postlen) { }
486 0 0 if (my(@vals) = $str =~ /$pat/) { }
497 44 22 if @_
503 22 22 if @_
512 22 0 defined $opts->{'page'}{'width'} ? :
537 22 22 if (defined $field)
542 0 22 if (defined $userdef)
543 0 0 if ($userdef < 0) { }
555 0 22 if ($form{'isbullet'}) { }
564 0 22 if $fld =~ /["']/ and not $fld =~ /[][><]/
569 0 22 $fld =~ s/_//g ? :
0 22 $fld =~ s/=//g ? :
575 0 22 if $extras
576 0 22 if ($checkwidth)
579 0 0 if s/([][>
580 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([][>
581 0 0 if s/(> [.,]) (\(\s*\d+[.,]?\d*\s*\))/$1 . '<' x length($2);/ex
582 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([.,] <)/'>' x length($1) . $2;/ex
583 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([.,] \[)/']' x length($1) . $2;/ex
584 0 0 if s/(\(\s*\d+[.,]?\d*\s*\))/'[' x length($1);/ex
588 16 6 if ($setwidth, $extras) = $fld =~ /\{\s*(\d+[.,]?\d*|\*)\s*\}/g
590 0 22 if $extras or $setwidth and $checkwidth
592 8 14 if ($setwidth and $setwidth =~ s/[.,](\d+)//)
597 0 0 $_->[1] != 1 ? :
0 8 if defined $_->[0] and defined $_->[1] and $_->[0] ne '*' and $_->[0] <= $_->[1]
605 5 17 $fld =~ s/$precurrpat/$1 . $3 x length($2) . $3;/e ? :
606 0 22 $fld =~ /$incurrpat/ ? :
608 2 20 $fld =~ s/$postcurrpat/$1 . $1 x length($2) . $3;/e ? :
611 0 22 if ($form{'width'} == 2) { }
0 22 elsif ($form{'width'} == 3) { }
22 0 elsif ($form{'width'} > 3) { }
627 16 6 if defined $setwidth and $setwidth ne '*'
630 0 22 if ($form{'width'} == 2) { }
0 22 elsif ($form{'width'} == 3) { }
22 0 elsif ($form{'width'} > 3) { }
645 16 6 if defined $setwidth and $setwidth ne '*'
649 0 22 if ($setwidth and $setwidth eq '*') { }
650 0 0 $form{'verbatim'} ? :
656 22 0 unless $form{'isbullet'} or $fld =~ /[][IV"]/
671 22 0 $fld =~ /^(?: [>,' 0]* \. [<0]* | [],' 0]* \. [[0]* | [>.' 0]* \, [<0]* | [].' 0]* \, [[0]* | [>.,' 0]* \Q$incurr\E [<0]* | [].,' 0]* \Q$incurr\E [[0]* | [].' 0]* \, [[0]* )$/x ? :
0 22 $fld =~ /^(?:V+)$/ ? :
0 22 $fld =~ /^(?:<+>+|\[+\]+)$/ ? :
0 22 $fld =~ /^(?:I+|\|+|>+<+|\]+\[+)$/ ? :
0 22 $fld =~ /^(?:>+|\]+)$/ ? :
0 22 $fld =~ /^(?:<+|\[+)$/ ? :
0 22 $form{'width'} == 1 ? :
680 0 22 if $form{'stretch'}
684 0 22 if defined $checkwidth and $form{'width'} != $checkwidth
686 0 22 if $form{'isbullet'}
693 0 22 if $form{'overflow'}
695 0 22 unless defined $args->[$i]
699 0 22 if $form{'isbullet'}
703 0 0 /\n\z/ ? :
0 0 !defined($_) ? :
706 0 0 $form{'trackpos'} ? :
708 22 0 &readonly($_) || !$form{'trackpos'} ? :
0 22 ref $_ eq 'ARRAY' ? :
723 0 22 if (@starred or @vstarred)
727 0 0 @starred ? :
730 0 0 if @starred
741 0 66 if ($lastbullet)
742 0 0 if ($f->{'literal'}) { }
0 0 elsif ($f->{'isbullet'}) { }
754 0 66 if $f->{'isbullet'}
756 0 22 if ($lastbullet)
770 0 66 if ($f->{'src'} == $group->[0]{'src'})
788 0 66 if $bullet
792 44 0 unless ($f->{'isbullet'} or $f->{'width'} == 1 or $f->{'verbatim'})
794 0 44 if ($skipped ||= 0)
799 0 0 if $tabular and $bulleted and @col
804 0 22 if ($text eq '' and $more and (pos ${$str_ref;} // -1) == $prev_pos)
809 0 66 if ($f->{'opts'}{'ws'})
811 0 0 length $1 ? :
0 0 unless @caps
815 22 44 if $eol
817 0 66 if ($bullet and $text =~ /\S/)
820 0 0 $bulleted ? :
823 0 66 if defined $f->{'opts'}{'height'}{'max'} and @col == $f->{'opts'}{'height'}{'max'}
824 66 0 if not $more or @col == $maxheight
825 0 0 if $f->{'line'}
828 22 44 if @col == 1 and $col[0] eq ''
829 0 66 if @_ > 3
838 66 0 if (@$group <= 1)
852 0 0 if ($maxheight <= $minheight + 1)
858 0 0 substr($$src, pos $$src) =~ /\S/ ? :
865 0 22 if grep {not $_->{'line'} || $_->{'literal'} || $_->{'notlastoverflow'};} @$formats
871 66 0 unless $_->{'overflow'}
872 0 0 if ($_->{'notlastoverflow'})
879 66 0 if not $_->{'overflow'} or $_->{'notlastoverflow'}
889 66 0 unless $fld->{'overflow'}
894 0 0 if $prev->{'literal'}
897 0 0 if ($right >= $prevleft and $left <= $prevright)
898 0 0 if ($overflowed)
900 0 0 if $prev->{'overflow'} and $prev->{'src'} == $fld->{'src'}
909 0 0 if $prev->{'overflow'}
913 0 0 unless $overflowed
922 0 66 if ($f->{'isbullet'}) { }
0 66 elsif ($f->{'opts'}{'height'}{'minimal'}) { }
929 22 0 if ($opts->{'layout'} eq 'balanced') { }
0 0 elsif ($opts->{'layout'} eq 'down') { }
0 0 elsif ($opts->{'layout'} eq 'across') { }
933 0 66 unless $_->{'formcol'}
934 22 0 if grep {not $_->{'literal'} || $_->{'opts'}{'height'}{'minimal'};} @$formatters
945 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
949 0 0 defined $_ ? :
0 0 if $has_nonminimal
953 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
958 0 0 unless $f->{'isbullet'}
971 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
972 0 0 if $f->{'line'} and $row > 0 or $f->{'done'}
974 0 0 unless $f->{'verbatim'}
977 0 0 if $f->{'opts'}{'ws'}
979 0 0 if not $f->{'literal'} and $row + 1 >= ($f->{'opts'}{'height'}{'max'} || $maxheight)
981 0 0 unless $f->{'literal'} or $f->{'line'} or $f->{'done'}
985 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
986 0 0 if $f->{'line'} and $row > 0 or $f->{'done'}
988 0 0 unless $f->{'verbatim'}
991 0 0 if $f->{'opts'}{'ws'}
993 0 0 if not $f->{'literal'} and $row + 1 >= ($f->{'opts'}{'height'}{'max'} || $maxheight)
995 0 0 unless $has_nonminimal or $f->{'done'}
999 0 0 unless $f->{'isbullet'}
1012 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
1018 0 0 defined $_ ? :
0 0 if $has_nonminimal
1023 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
1029 0 0 if ($f->{'isbullet'}) { }
0 0 elsif ($f->{'literal'}) { }
1030 0 0 unless $f->{'bullets'}
1048 0 66 if substr($$text, pos $$text || 0) =~ /\S/
1050 22 44 unless @{$$parts[$$g[-$_]{'index'}];}
1059 0 0 if $f->{'done'} or $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
1060 0 0 if substr(${$f->{'src'};}, pos ${$$f{'src'};} || 0) =~ /\S/
1070 0 0 $_->{'literal'} ? :
1071 0 0 $1 =~ /\s/ ? :
1081 0 88 /[^\n]\z/ ? :
1087 0 22 unless defined wantarray
1092 22 0 if (keys %$caller_opts)
1094 22 0 if defined $line
1106 0 22 if (ref $format eq 'HASH')
1108 0 0 unless defined $format->{'page'}{'number'}
1112 22 0 if ($first)
1113 0 22 if ($opts{'interleave'})
1123 0 22 if (defined $opts{'under'})
1131 0 22 if @_
1138 0 22 unless $section->{'formatters'}
1141 1 21 unless defined $page->{'number'}
1144 11 11 $page->{'number'} % 2 ? :
1148 0 0 $page->{'header'}{'other'} ? :
0 0 $page->{'header'}{$parity} ? :
22 0 $page->{'header'}{$pagetype} ? :
1153 0 0 $page->{'footer'}{'other'} ? :
0 0 $page->{'footer'}{$parity} ? :
22 0 $page->{'footer'}{$pagetype} ? :
1158 0 0 $page->{'feed'}{'other'} ? :
0 0 $page->{'feed'}{$parity} ? :
22 0 $page->{'feed'}{$pagetype} ? :
1167 22 0 if (not $more and $section == $section[-1])
1169 0 22 $page->{'header'}{'last'} ? :
1172 0 22 $page->{'footer'}{'last'} ? :
1176 22 0 if (@$pagetext <= $lastlen)
1181 0 22 if $page->{'feed'}{'last'}
1183 0 22 if $page->{'body'}{'last'}
1186 0 22 $pagelen < $unlimited ? :
1195 22 0 unless $more or $section == $section[-1] and $pagetype ne 'last'
1196 0 0 $page->{'number'} % 2 ? :
1201 22 0 unless $opts{'untrimmed'}
1213 22 0 unless $more
1252 0 0 if ref $structure eq 'HASH'
1256 0 0 unless my $type = ref $row
1257 0 0 if ($type eq 'HASH') { }
0 0 elsif ($type eq 'ARRAY') { }
1258 0 0 unless @index
1262 0 0 unless @index
1267 0 0 $what ? :
1275 0 0 ref $_ eq 'HASH' ? :
1278 0 0 ref $_ eq 'HASH' ? :
1282 0 0 unless @indices
1284 0 0 @$index ? :
1285 0 0 unless @indices
1304 0 0 unless $$str =~ / \G ([^\n\r]*) (?:\r|\n|\z) /cgx
1305 0 0 $$str =~ / \G (?=.) /cgsx ? :
1310 22 0 if ($$str =~ /\G [^\S\n\r]* ([^\n\r]*?) [^\S\r\n]* (?:\r|$)/cgmx) { }
1311 0 22 $$str =~ /\G(?=.*\S)/cgs ? :
1331 0 0 if ($ws and /\G ($ws) $wsnzw/cgx) { }
0 0 elsif ($rem >= $hylen and /\G $lit_hy /cgx) { }
0 0 elsif (/\G ((?!$lit_hy)[^\n\r]) /cgx) { }
1333 0 0 if ($#+ > 1)
1335 0 0 unless defined $$_
1341 0 0 unless ($captured)
1355 0 0 if $res =~ /\s$/
1361 0 0 unless (/\G (?=$lit_hy|($ws)$wsnzw|\z|\n|\r) /cgx)
1362 0 0 if ($last_breakable <= $reslen) { }
0 0 elsif ($reslen > $hylen) { }
1367 0 0 if ($res =~ /\S\S\S{$hylen}$/) { }
0 0 elsif ($res =~ s/(\S+)$//) { }
1377 0 0 $rem =~ /\S/ ? :
1387 0 0 unless ref $_ eq 'HASH'