Branch Coverage

blib/lib/IO/Prompter.pm
Criterion Covered Total %
branch 137 374 36.6


line true false branch
87 0 42 if (defined $config_data and $config_data eq '-argv') { }
3 39 elsif (ref $config_data eq 'ARRAY') { }
2 37 elsif (ref $config_data eq 'HASH') { }
2 35 elsif (defined $config_data) { }
135 2 95 if &VOID() and not $opt_ref->{'-void'}
139 0 97 ($opt_ref->{'-yesno'}{'count'} // 0) > 1 ? :
144 0 97 unless (&openhandle($in_filehandle))
145 0 0 unless open my $fh, '<', $in_filehandle
149 0 97 unless (&openhandle($out_filehandle))
150 0 0 unless open my $fh, '>', $out_filehandle
159 0 97 unless &openhandle($in_filehandle) and &openhandle($out_filehandle)
162 0 97 -t $in_filehandle && -t $out_filehandle ? :
171 0 97 if ($opt_ref->{'-wipe'})
178 1 96 if ($opt_ref->{'-menu'}) { }
195 0 1 unless defined $tag
199 0 1 if ($tag eq $MENU_ESC)
201 0 0 if @menu <= 1
207 1 0 if ($tag =~ /\A\R?\Z/ and exists $opt_ref->{'-def'})
214 0 0 unless ref $input
234 5 0 if (defined $input and $input =~ /\A\R?\Z/ and exists $opt_ref->{'-def'})
240 82 15 if (defined $input and not $opt_ref->{'-line'})
245 2 95 if (exists $opt_ref->{'-fail'} and $input ~~ $opt_ref->{'-fail'})
250 1 96 if ($opt_ref->{'-argv'})
262 84 12 if (defined $input and $opt_ref->{'-history'} ne 'NONE')
269 0 6 if ($timedout and exists $opt_ref->{'-def'})
278 27 69 if ($opt_ref->{'-yesno'}{'count'})
280 0 27 if ($succeeded and $opt_ref->{'-yesno'}{'count'} > 1)
283 0 0 $count > 1 ? :
0 0 @yesno_prompts ? :
292 6 90 if ($opt_ref->{'-verbatim'})
297 4 86 if &LIST() and not $succeeded
307 0 0 unless $timedout
309 0 0 $opt_ref->{'-timeout'} == 1 ? :
320 1 4 if ($text =~ /\A ' (.*) ' \z/msx)
329 2 2 if ($text =~ /\A " (.*) " \z/msx)
366 1 0 if ref $style or not $style =~ m[/]
370 0 0 /y/i ? :
377 0 0 if ref $style or not $style =~ m[/]
381 0 0 /y/i ? :
394 1 0 ref $arg ne 'CODE' ? :
405 2 1 if ref $constraint_spec
419 3 3 unless &$constraint($compare_val)
437 0 30 $char eq "\t" ? :
443 0 220 if (my $type = ref $arg) { }
467 0 4 @_ && &looks_like_number($_[0]) ? :
481 0 4 @_ && &looks_like_number($_[0]) ? :
495 0 7 @_ && &looks_like_number($_[0]) ? :
509 0 5 @_ && &looks_like_number($_[0]) ? :
530 0 0 $1 ? :
541 0 3 unless @_
554 0 0 unless @_
561 0 0 unless @_
577 3 3 if (@_ and ref $_[0] || $_[0] =~ /$STD_CONSTRAINT/)
585 0 2 if (@_ and ref $_[0] || $_[0] =~ /$STD_CONSTRAINT/)
607 0 0 unless @_
611 0 0 if ref $option{'-def'}
614 0 5 unless @_
617 0 5 if ref $option{'-def'}
628 1 1 unless @_
631 1 0 if not &looks_like_number($option{'-timeout'})
636 0 8 unless @_
643 2 6 if ($restriction_type eq 'HASH')
648 7 1 if ($restriction_type eq 'ARRAY') { }
1 0 elsif ($restriction_type eq 'Regexp') { }
658 7 0 if ($option{'-complete'} == $DEFAULT_COMPLETER)
680 0 4 if (@defaults > 1) { }
2 2 elsif (@defaults) { }
691 2 2 if (@defaults == 1)
707 0 6 unless @_
709 0 6 if ref $must ne 'HASH'
719 0 0 @_ && !($_[0] =~ /^-/) ? :
722 0 0 if ref $option{'-history'}
724 0 0 length $1 ? :
728 0 0 unless @_
731 0 0 if ($comp_type =~ /\A(?: file\w* | dir\w* | ARRAY | HASH | CODE )\Z/msx) { }
742 0 0 $1 eq 'echo' ? :
743 0 0 if ($flag eq '-echo' and not eval { do { BEGIN {${^WARNING_BITS} = "\x44\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15\x00\x04\x40\x45\x05"} require Term::ReadKey } })
746 0 0 $flag eq '-echo' ? :
0 0 @_ && !($_[0] =~ /^-/) ? :
752 1 0 unless (eval { do { BEGIN {${^WARNING_BITS} = "\x44\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15\x00\x04\x40\x45\x05"} require Term::ReadKey } })
768 0 0 unless @_
771 0 0 if ref $option{'-prompt'}
779 0 1 unless @_
780 1 0 ref $_[0] ? :
793 12 206 if $redo and $arg =~ s/\A -.{$redo} (?=.)/-/msx
798 1 96 if (exists $option{'-menu'})
806 6 91 if (defined $option{'-single'} and length($option{'-echo'}->('X') // 'echoself'))
811 1 96 if ($option{'-argv'}) { }
3 93 elsif (not defined $option{'-prompt'}) { }
79 14 elsif ($option{'-prompt'} =~ / \S \z/msx) { }
0 14 elsif ($option{'-prompt'} =~ / (.*) \n \z/msx) { }
824 0 0 if $not_first++
844 6 91 if (exists $option{'-def'} and not $option{'-def_nocheck'})
845 0 6 unless (_verify_input_constraints(\'', undef, undef, \%option))
865 2 3 unless warnings::enabled($category)
868 1 2 $message =~ /\n$/ ? :
876 0 80 unless (&openhandle(\*ARGV))
878 0 0 unless open *ARGV
902 11 0 if (${$input_ref;} =~ /^\R?$/msx and exists $opt_ref->{'-def'})
903 1 10 if $opt_ref->{'-def_nocheck'}
910 4 116 if ($opt_ref->{'-integer'} and not $input =~ /$INTEGER_PAT/)
915 2 114 if (not $failed and $opt_ref->{'-number'} and not $input =~ /$NUMBER_PAT/)
922 0 36 /^\d+[.:]?\s*(.*)/s ? :
938 62 58 if (not $failed and keys %constraint_for)
942 40 22 if eval { do { no warnings; local $_ = $input; $input ~~ $constraint } }
947 5 15 $msg =~ /\A \W /msx ? :
2 20 $msg =~ /\A [[:upper:]] /msx ? :
954 28 92 if ($failed)
956 0 28 unless $outputter_ref
966 0 28 if (defined $fake_input and length $fake_input > 0)
988 0 97 if ($has_timeout and $fileno >= 0)
995 4 93 if (defined $fake_input and length $fake_input > 0)
1005 125 0 if (not $has_timeout or select $readbits, undef, undef, $timeout) { }
1009 121 4 if (not defined $local_fake_input) { }
1023 0 4 if ($input =~ /^ \s* (?: \cD | \cZ ) /msx)
1028 115 10 if (defined $input)
1035 6 91 defined $input && $opt_ref->{'-single'} ? :
1124 0 0 /\A (.*?) \R \Z/x ? :
1134 0 0 unless $common_length
1143 0 0 if @candidates <= 1
1174 97 0 unless (-t $in_fh and $has_readkey)
1184 0 0 $^O eq 'MSWin32' ? :
1194 0 0 $opt_ref->{'-timeout'} == 0 ? :
0 0 !defined($opt_ref->{'-timeout'}) ? :
1200 0 0 unless &openhandle($in_fh)
1221 0 0 if (defined $fake_input and length $fake_input > 0)
1238 0 0 unless (($next // '') =~ / $COMPLETE_INIT | $COMPLETE_CYCLE /msx)
1247 0 0 if (defined $next)
1252 0 0 if ($next eq $ctrl{'INTERRUPT'}) { }
0 0 elsif (not $prev_was_verbatim and $next eq $VERBATIM_KEY) { }
0 0 elsif (not $prev_was_verbatim and $next =~ /$COMPLETE_INIT/ || $completion_level > 0 && $next =~ /$COMPLETE_CYCLE/) { }
0 0 elsif (not $prev_was_verbatim and $next eq $ctrl{'ERASE'}) { }
0 0 elsif (not $prev_was_verbatim and $next eq $ctrl{'EOF'}) { }
0 0 elsif (not $prev_was_verbatim and $faking and $next eq $FAKE_ESC) { }
0 0 elsif (not $prev_was_verbatim and $next =~ /\A\R\z/) { }
0 0 elsif ($prev_was_verbatim or not $next =~ /$ctrl/) { }
1275 0 0 if ($next =~ /$COMPLETE_INIT/ and index($completion_type, $next) < 0) { }
1276 0 0 index($COMPLETE_KEY, $next) >= 0 ? :
1284 0 0 if ($completion_level == 1)
1285 0 0 index($COMPLETE_KEY, $next) >= 0 ? :
1294 0 0 if (@completion_list)
1300 0 0 if ($mode =~ /longest/) { }
0 0 elsif ($mode =~ /full/) { }
1307 0 0 unless ($completion_ring_first)
1308 0 0 if ($next eq $COMPLETE_PREV) { }
1321 0 0 $mode =~ /list/ ? :
1333 0 0 if (@completion_list <= 1)
1342 0 0 if (not length $input) { }
0 0 elsif ($insert_offset) { }
1347 0 0 if $insert_offset >= length $input
1368 0 0 if ($faking)
1384 0 0 length $input ? :
1392 0 0 if ($lookahead eq $FAKE_ESC) { }
1407 0 0 if ($faking and length $local_fake_input)
1425 0 0 if ($input =~ /\A\R?\Z/msx and defined $opt_ref->{'-def'})
1429 0 0 if (exists $opt_ref->{'-menu_curr_level'})
1431 0 0 if ($def_val ~~ $opt_ref->{'-menu_curr_level'}{$key})
1449 0 0 if ($faking and $input =~ /^ (?: \cD | \cZ) /msx)
1459 0 0 if ($faking)
1460 0 0 length $local_fake_input ? :
1466 0 0 if ($next eq $EDIT{'BACK'}) { }
0 0 elsif ($next eq $EDIT{'FORWARD'}) { }
0 0 elsif ($next eq $EDIT{'START'}) { }
0 0 elsif ($next eq $EDIT{'END'}) { }
1467 0 0 $insert_offset < length $input ? :
1470 0 0 $insert_offset > 0 ? :
1482 0 0 if (exists $opt_ref->{'-guarantee'})
1483 0 0 unless ($input . $next) =~ /$opt_ref->{'-guarantee'}/
1487 0 0 if ($insert_offset) { }
1498 0 0 if ($insert_offset or $prev_insert_offset) { }
0 0 elsif (not $next =~ /$EDIT_KEY/) { }
1525 0 0 if ($opt_ref->{'-single'} or not defined $next or $input =~ m[\Q$/\E$])
1527 0 0 if (defined $next)
1538 0 0 if not defined $next and length $input == 0
1541 0 0 if ($opt_ref->{'-single'} and exists $opt_ref->{'-return'} and not $input =~ /\A\R\z/)
1565 0 0 $is_numeric ? :
1579 1 0 $is_numeric ? :
1580 1 0 unless (keys %value_for)
1590 0 1 if (@source)
1598 0 0 $final =~ /[A-Z]/ ? :
1 0 $is_numeric ? :
1601 1 0 $is_numeric ? :
1656 0 0 if (ref $spec eq 'ARRAY') { }
0 0 elsif (ref $spec eq 'HASH') { }
1675 0 0 exists $synonyms{$2} ? :
1681 0 0 @style ? :
1691 0 0 if (eval { do { require Term::ANSIColor } }) { }