Branch Coverage

blib/lib/Perl6/Form.pm
Criterion Covered Total %
branch 159 542 29.3


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)
385 15 7 if ($integral) { }
393 0 22 if ($fail) { }
398 15 7 unless $w
399 22 0 if ($grouping)
402 22 0 if ($group)
405 0 22 if @groups
409 20 0 $w ? :
4 18 if (length $w > $width or not $val{'stretch'} and ($w ? length $w : 0) + length($pre) > $whole) { }
413 14 4 $integral ? :
414 18 0 unless $orig =~ /\.\d\{$places,\}[1-9]/
416 14 4 if ($integral and $str < 0)
417 2 12 if ($pre =~ /[(]/ or $post =~ /[)]/) { }
425 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/([][>
581 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([][>
583 0 0 if s/(> [.,]) (\(\s*\d+[.,]?\d*\s*\))/$1 . '<' x length($2);/ex
585 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([.,] <)/'>' x length($1) . $2;/ex
587 0 0 if s/(\(\s*\d+[.,]?\d*\s*\)) ([.,] \[)/']' x length($1) . $2;/ex
589 0 0 if s/(\(\s*\d+[.,]?\d*\s*\))/'[' x length($1);/ex
594 16 6 if ($setwidth, $extras) = $fld =~ /\{\s*(\d+[.,]?\d*|\*)\s*\}/g
596 0 22 if $extras or $setwidth and $checkwidth
598 8 14 if ($setwidth and $setwidth =~ s/[.,](\d+)//)
603 0 0 $_->[1] != 1 ? :
0 8 if defined $_->[0] and defined $_->[1] and $_->[0] ne '*' and $_->[0] <= $_->[1]
611 5 17 $fld =~ s/$precurrpat/$1 . $3 x length($2) . $3;/e ? :
612 0 22 $fld =~ /$incurrpat/ ? :
614 2 20 $fld =~ s/$postcurrpat/$1 . $1 x length($2) . $3;/e ? :
617 0 22 if ($form{'width'} == 2) { }
0 22 elsif ($form{'width'} == 3) { }
22 0 elsif ($form{'width'} > 3) { }
633 16 6 if defined $setwidth and $setwidth ne '*'
636 0 22 if ($form{'width'} == 2) { }
0 22 elsif ($form{'width'} == 3) { }
22 0 elsif ($form{'width'} > 3) { }
651 16 6 if defined $setwidth and $setwidth ne '*'
655 0 22 if ($setwidth and $setwidth eq '*') { }
656 0 0 $form{'verbatim'} ? :
662 22 0 unless $form{'isbullet'} or $fld =~ /[][IV"]/
677 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 ? :
686 0 22 if $form{'stretch'}
690 0 22 if defined $checkwidth and $form{'width'} != $checkwidth
692 0 22 if $form{'isbullet'}
699 0 22 if $form{'overflow'}
701 0 22 unless defined $args->[$i]
705 0 22 if $form{'isbullet'}
709 0 0 /\n\z/ ? :
0 0 !defined($_) ? :
712 0 0 $form{'trackpos'} ? :
714 22 0 &readonly($_) || !$form{'trackpos'} ? :
0 22 ref $_ eq 'ARRAY' ? :
729 0 22 if (@starred or @vstarred)
733 0 0 @starred ? :
736 0 0 if @starred
747 0 66 if ($lastbullet)
748 0 0 if ($f->{'literal'}) { }
0 0 elsif ($f->{'isbullet'}) { }
760 0 66 if $f->{'isbullet'}
762 0 22 if ($lastbullet)
776 0 66 if ($f->{'src'} == $group->[0]{'src'})
794 0 66 if $bullet
798 44 0 unless ($f->{'isbullet'} or $f->{'width'} == 1 or $f->{'verbatim'})
800 0 44 if ($skipped ||= 0)
805 0 0 if $tabular and $bulleted and @col
809 0 66 if ($f->{'opts'}{'ws'})
812 0 0 length $1 ? :
0 0 unless @caps
816 22 44 if $eol
818 0 66 if ($bullet and $text =~ /\S/)
821 0 0 $bulleted ? :
824 0 66 if defined $f->{'opts'}{'height'}{'max'} and @col == $f->{'opts'}{'height'}{'max'}
825 66 0 if not $more or @col == $maxheight
826 0 0 if $f->{'line'}
829 22 44 if @col == 1 and $col[0] eq ''
830 0 66 if @_ > 3
839 66 0 if (@$group <= 1)
853 0 0 if ($maxheight <= $minheight + 1)
859 0 0 substr($$src, pos $$src) =~ /\S/ ? :
866 0 22 if grep {not $_->{'line'} || $_->{'literal'} || $_->{'notlastoverflow'};} @$formats
872 66 0 unless $_->{'overflow'}
873 0 0 if ($_->{'notlastoverflow'})
880 66 0 if not $_->{'overflow'} or $_->{'notlastoverflow'}
890 66 0 unless $fld->{'overflow'}
895 0 0 if $prev->{'literal'}
898 0 0 if ($right >= $prevleft and $left <= $prevright)
899 0 0 if ($overflowed)
901 0 0 if $prev->{'overflow'} and $prev->{'src'} == $fld->{'src'}
910 0 0 if $prev->{'overflow'}
914 0 0 unless $overflowed
923 0 66 if ($f->{'isbullet'}) { }
0 66 elsif ($f->{'opts'}{'height'}{'minimal'}) { }
930 22 0 if ($opts->{'layout'} eq 'balanced') { }
0 0 elsif ($opts->{'layout'} eq 'down') { }
0 0 elsif ($opts->{'layout'} eq 'across') { }
934 0 66 unless $_->{'formcol'}
935 22 0 if grep {not $_->{'literal'} || $_->{'opts'}{'height'}{'minimal'};} @$formatters
946 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
950 0 0 defined $_ ? :
0 0 if $has_nonminimal
954 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
959 0 0 unless $f->{'isbullet'}
972 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
973 0 0 if $f->{'line'} and $row > 0 or $f->{'done'}
975 0 0 unless $f->{'verbatim'}
978 0 0 if $f->{'opts'}{'ws'}
980 0 0 if not $f->{'literal'} and $row + 1 >= ($f->{'opts'}{'height'}{'max'} || $maxheight)
982 0 0 unless $f->{'literal'} or $f->{'line'} or $f->{'done'}
986 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
987 0 0 if $f->{'line'} and $row > 0 or $f->{'done'}
989 0 0 unless $f->{'verbatim'}
992 0 0 if $f->{'opts'}{'ws'}
994 0 0 if not $f->{'literal'} and $row + 1 >= ($f->{'opts'}{'height'}{'max'} || $maxheight)
996 0 0 unless $has_nonminimal or $f->{'done'}
1000 0 0 unless $f->{'isbullet'}
1013 0 0 if $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
1019 0 0 defined $_ ? :
0 0 if $has_nonminimal
1024 0 0 if $f->{'isbullet'} or not $f->{'opts'}{'height'}{'minimal'}
1030 0 0 if ($f->{'isbullet'}) { }
0 0 elsif ($f->{'literal'}) { }
1031 0 0 unless $f->{'bullets'}
1049 0 66 if substr($$text, pos $$text || 0) =~ /\S/
1051 22 44 unless @{$$parts[$$g[-$_]{'index'}];}
1060 0 0 if $f->{'done'} or $f->{'isbullet'} or $f->{'opts'}{'height'}{'minimal'}
1061 0 0 if substr(${$f->{'src'};}, pos ${$$f{'src'};} || 0) =~ /\S/
1071 0 0 $_->{'literal'} ? :
1072 0 0 $1 =~ /\s/ ? :
1082 0 88 /[^\n]\z/ ? :
1088 0 22 unless defined wantarray
1093 22 0 if (keys %$caller_opts)
1095 22 0 if defined $line
1107 0 22 if (ref $format eq 'HASH')
1109 0 0 unless defined $format->{'page'}{'number'}
1113 22 0 if ($first)
1114 0 22 if ($opts{'interleave'})
1124 0 22 if (defined $opts{'under'})
1132 0 22 if @_
1139 0 22 unless $section->{'formatters'}
1142 1 21 unless defined $page->{'number'}
1145 11 11 $page->{'number'} % 2 ? :
1149 0 0 $page->{'header'}{'other'} ? :
0 0 $page->{'header'}{$parity} ? :
22 0 $page->{'header'}{$pagetype} ? :
1154 0 0 $page->{'footer'}{'other'} ? :
0 0 $page->{'footer'}{$parity} ? :
22 0 $page->{'footer'}{$pagetype} ? :
1159 0 0 $page->{'feed'}{'other'} ? :
0 0 $page->{'feed'}{$parity} ? :
22 0 $page->{'feed'}{$pagetype} ? :
1168 22 0 if (not $more and $section == $section[-1])
1170 0 22 $page->{'header'}{'last'} ? :
1173 0 22 $page->{'footer'}{'last'} ? :
1177 22 0 if (@$pagetext <= $lastlen)
1182 0 22 if $page->{'feed'}{'last'}
1184 0 22 if $page->{'body'}{'last'}
1187 0 22 $pagelen < $unlimited ? :
1196 22 0 unless $more or $section == $section[-1] and $pagetype ne 'last'
1197 0 0 $page->{'number'} % 2 ? :
1202 22 0 unless $opts{'untrimmed'}
1214 22 0 unless $more
1253 0 0 if ref $structure eq 'HASH'
1257 0 0 unless my $type = ref $row
1258 0 0 if ($type eq 'HASH') { }
0 0 elsif ($type eq 'ARRAY') { }
1259 0 0 unless @index
1263 0 0 unless @index
1268 0 0 $what ? :
1276 0 0 ref $_ eq 'HASH' ? :
1279 0 0 ref $_ eq 'HASH' ? :
1283 0 0 unless @indices
1285 0 0 @$index ? :
1286 0 0 unless @indices
1305 0 0 unless $$str =~ / \G ([^\n\r]*) (?:\r|\n|\z) /cgx
1306 0 0 $$str =~ / \G (?=.) /cgsx ? :
1311 22 0 if ($$str =~ /\G [^\S\n\r]* ([^\n\r]*?) [^\S\r\n]* (?:\r|$)/cgmx) { }
1312 0 22 $$str =~ /\G(?=.*\S)/cgs ? :
1332 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) { }
1334 0 0 if ($#+ > 1)
1336 0 0 unless defined $$_
1342 0 0 unless ($captured)
1356 0 0 if $res =~ /\s$/
1362 0 0 unless (/\G (?=$lit_hy|($ws)$wsnzw|\z|\n|\r) /cgx)
1363 0 0 if ($last_breakable <= $reslen) { }
0 0 elsif ($reslen > $hylen) { }
1368 0 0 if ($res =~ /\S\S\S{$hylen}$/) { }
0 0 elsif ($res =~ s/(\S+)$//) { }
1378 0 0 $rem =~ /\S/ ? :
1388 0 0 unless ref $_ eq 'HASH'