Branch Coverage

blib/lib/Expect.pm
Criterion Covered Total %
branch 222 540 41.1


line true false branch
63 0 0 if defined $version and $version > $Expect::VERSION
66 0 0 if defined $version and $version < "1.03"
74 0 151 if ref $class
78 0 151 unless $self
87 72 79 if (@args)
97 6 8 if @_
107 125 27 if (ref $class) { }
114 2 150 if exists do {
118 0 150 unless pipe FROM_CHILD, TO_PARENT
119 0 150 unless pipe FROM_PARENT, TO_CHILD
126 0 150 unless (defined $pid)
127 0 0 if $^W
131 129 21 if ($pid) { }
139 19 110 if $self->raw_pty and isatty($self)
144 0 129 unless defined $errstatus
146 14 115 if ($errstatus)
148 0 14 if $^W
158 0 21 unless my $slv = $self->slave
161 4 17 if $self->raw_pty
167 0 21 unless defined $errstatus
171 0 21 unless open STDIN, '<&' . $slv->fileno
174 0 21 unless open STDOUT, '>&' . $slv->fileno
177 0 21 unless open STDERR, '>&' . $slv->fileno
191 0 115 if (do {
210 0 0 unless defined $self->fileno
221 0 0 if $self->fileno == fileno STDIN
223 0 0 if do {
276 0 374 unless my $type = ref $self
283 0 374 unless (exists $Readable_Vars{$name})
288 221 153 if exists do {
290 90 284 if (@args)
291 90 0 if (exists $Writeable_Vars{$name}) { }
293 0 90 if ($ref eq 'ARRAY') { }
0 90 elsif ($ref eq 'HASH') { }
301 0 0 if $^W
307 7 0 wantarray ? :
7 367 if $ref eq "ARRAY"
308 0 0 wantarray ? :
0 367 if $ref eq "HASH"
320 0 0 if (not defined $function or $function eq "undef")
326 0 0 if (do {
338 0 0 unless (defined $args[0])
339 0 0 if (defined do {
348 0 0 unless ($self->_get_mode =~ /r/)
355 0 0 unless ($write_handle->_get_mode =~ /w/)
371 0 73 if @_ < 2
374 10 63 if (do {
378 29 44 unless $file
380 26 18 unless (ref $file)
383 0 26 unless $fh = "IO::File"->new($file, $mode)
386 26 18 if (ref $file ne "CODE")
387 0 26 unless $fh->can("print")
403 0 0 unless defined $mode
404 0 0 unless (defined $INC{'IO/Stty.pm'})
409 0 0 if (do {
412 0 0 unless (POSIX::isatty($self))
413 0 0 if (do {
471 0 5521 if $Expect::Debug
472 5521 0 if (defined $_[0])
473 5521 0 if (ref $_[0] and $_[0]->isa('Expect')) { }
0 0 elsif ($_[0] eq 'Expect') { }
479 0 5521 if @_ < 1
482 5513 8 if (&looks_like_number($_[0]) or not defined $_[0]) { }
497 5521 0 if ($self) { }
504 0 0 if $_[0] ne "-i"
513 0 16429 if $Expect::Debug
515 16310 119 if (ref $parm) { }
516 1 16309 if (ref $parm eq 'Regexp') { }
16309 0 elsif (ref $parm eq 'ARRAY') { }
525 0 16309 if @timeout_list > 1
529 10713 5596 if $timeout_list[-1]
530 0 16309 if $err
538 22 97 if (substr($parm, 0, 1) eq '-') { }
541 0 22 if $Expect::Debug
543 0 22 if ($parm eq '-i') { }
22 0 elsif ($parm eq '-re' or $parm eq '-ex') { }
546 0 0 if (scalar @$curr_list)
548 0 0 unless exists $patterns{"$curr_list"}
554 0 0 if (ref $_[0] eq 'ARRAY') { }
562 0 22 if (ref $_[1] eq 'CODE') { }
574 0 97 if (ref $_[0] eq 'CODE') { }
575 0 0 if ($parm eq 'timeout') { }
0 0 elsif ($parm eq 'eof') { }
577 0 0 if @timeout_list > 1
582 0 0 if $timeout_list[-1]
589 0 97 if $Expect::Debug
599 0 5521 unless $curr_list
600 5521 0 unless exists $patterns{"$curr_list"}
603 5521 0 $self ? :
604 5521 0 $self ? :
608 0 5521 if (@Expect::Before_List)
609 0 0 if $debug or $internal
614 0 5521 if $debug or $internal
622 0 5521 if (@Expect::After_List)
623 0 0 if $debug or $internal
628 0 5521 wantarray ? :
637 5415 106 if ($timeout_hook)
638 0 5415 unless ref $timeout_hook eq "CODE" or ref $timeout_hook eq "ARRAY"
647 0 5521 if (exists do {
655 0 0 defined $timeout ? :
0 5521 if $Expect::Debug
664 0 5521 if (do {
667 0 0 defined $pattern->[0] ? :
701 11077 3 if (defined $timeout)
703 0 11077 if $time_left < 0
717 11080 0 if defined $fn
719 48 11032 unless do {
736 0 11032 if do {
751 0 0 defined $pattern->[0] ? :
0 16539 if do {
754 136 16403 if ($pattern->[1] eq '-ex') { }
11023 5380 elsif ($pattern->[1] eq '-re') { }
759 34 102 if ($match_index > -1)
778 11009 14 if ($Expect::Multiline_Matching) { }
785 5503 5520 if (@matchlist)
790 0 5503 if $start == -1
807 5537 11002 if ($exp_matched)
809 5487 50 unless do {
811 0 5537 if do {
828 0 5537 if do {
831 5481 56 if ($pattern->[3])
836 0 5481 if do {
837 0 5481 if ($#{$pattern;} > 3) { }
845 70 5467 if ($exp_cont and $exp_cont eq exp_continue()) { }
0 5471 elsif ($exp_cont and $exp_cont eq exp_continue_timeout()) { }
848 0 70 if do {
856 0 0 if do {
861 0 11002 if do {
863 0 5495 if do {
871 0 0 defined $time_left ? :
0 5543 if $Expect::Exp_Internal or $Expect::Debug
879 0 5543 if ($nfound < 0)
880 0 0 if ($!{'EINTR'} and $Expect::IgnoreEintr)
881 0 0 if $Expect::Exp_Internal or $Expect::Debug
885 0 0 if $Expect::Exp_Internal or $Expect::Debug
895 77 5466 if ($nfound == 0)
902 0 77 unless defined $exp->fileno
903 41 36 unless do {
906 0 77 if $Expect::Debug or $Expect::Exp_Internal
908 51 26 if ($timeout_hook)
910 0 51 if $Expect::Debug or $Expect::Exp_Internal
912 0 51 if (ref $timeout_hook eq 'CODE') { }
915 0 51 if ($#{$timeout_hook;} > 3) { }
924 48 3 if ($ret and $ret eq exp_continue())
935 0 5466 unless defined $exp->fileno
936 5466 0 if ($bits[$exp->fileno])
937 0 5466 if $Expect::Debug
945 25 5441 unless defined $nread
947 25 5441 if ($nread == 0)
948 0 25 if $Expect::Debug
957 0 10 if $Expect::Debug
959 0 10 if ($#{$eof_pat;} > 3) { }
966 0 10 if ($ret and $ret eq exp_continue() || $ret eq exp_continue_timeout())
976 25 0 if (defined do {
979 25 0 if ($ret == do {
982 0 25 if $Expect::Debug
991 0 25 if $Expect::Debug
996 0 5441 if $Expect::Debug
1001 1292 4149 unless do {
1005 0 5441 if (exists do {
1017 0 0 if exists do {
1027 0 5466 if $exp_cont and $exp_cont eq exp_continue()
1034 0 5521 if ($Expect::Debug or $Expect::Exp_Internal)
1035 0 0 if ($exp_matched) { }
1041 0 0 do {
0 0 do {
1048 0 0 if ($Expect::Debug and $exp_matched)
1050 0 0 if (do {
1064 5467 54 if ($exp_matched)
1071 5467 0 wantarray ? :
1074 54 0 wantarray ? :
1090 0 16309 unless (ref $parm eq "ARRAY")
1094 0 16309 if ($parm->[0] =~ /\A-/) { }
1097 0 0 if ($parm->[0] ne "-re" and $parm->[0] ne "-ex")
1103 5415 10894 if ($parm->[0] eq 'timeout') { }
5415 5479 elsif ($parm->[0] eq 'eof') { }
1104 5415 0 if (defined $timeoutlistref)
1106 5415 0 $store_parm_nr ? :
1116 10891 3 if (@$parm > 2) { }
1117 0 10891 if (ref $parm->[2] ne "CODE")
1127 10894 0 $store_parm_nr ? :
1147 0 0 do {
0 0 defined $infile ? :
1164 0 0 if (defined $outfile) { }
1174 0 0 if defined $escape_sequence
1200 0 0 unless (@old_group)
1228 0 0 if ($Expect::Debug)
1244 0 0 unless (do {
1249 0 0 if do {
1253 0 0 unless (do {
1257 0 0 if do {
1263 0 0 if $Expect::Debug
1277 0 0 if exists do {
1278 0 0 if (exists do {
1284 0 0 if do {
1286 0 0 unless defined do {
1289 0 0 unless &{do {
1297 0 0 if not defined $nfound or $nfound < 1
1301 0 0 unless defined $eout
1306 0 0 if ($bits[$read_handle->fileno])
1313 0 0 unless defined $nread
1315 0 0 if do {
1319 0 0 unless defined $escape_character_buffer
1324 0 0 if do {
1330 0 0 if do {
1331 0 0 if ($escape_character_buffer =~ /($escape_sequence)/)
1333 0 0 if (do {
1352 0 0 if (do {
1367 0 0 unless &{do {
1370 0 0 unless defined $nread
1373 0 0 if defined do {
1374 0 0 if ($nread == 0)
1376 0 0 if do {
1378 0 0 unless defined do {
1381 0 0 unless &{do {
1383 0 0 if $nread < 0
1402 0 0 unless (do {
1406 0 0 unless (do {
1419 5326 146 if (do {
1420 54 5272 if (ref do {
1435 0 5308 unless defined $self->fileno
1436 0 5308 if (do {
1459 0 27 unless defined $self->fileno
1472 0 1170 if do {
1475 1170 0 if (do {
1483 0 27 if not defined $ret or $ret == 0
1491 0 27 if do {
1496 0 27 if do {
1513 0 0 unless defined $allmask
1517 0 0 unless $nfound
1527 0 0 if (defined $bits[$handle->fileno] and $bits[$handle->fileno])
1547 0 9 if do {
1548 0 9 unless defined $self->fileno
1549 9 0 unless (exists do {
1555 0 13 if $select_time < 0
1559 0 13 unless defined $nfound and $nfound
1563 9 4 unless (defined $nread and $nread)
1565 0 9 if do {
1570 0 0 if ($end_time <= time and do {
1575 0 9 if ($close_status and do {
1580 0 9 unless defined do {
1588 9 0 if (defined $returned_pid and $returned_pid)
1590 0 9 if (do {
1605 0 0 if (do {
1614 0 0 if (defined $returned_pid and $returned_pid)
1616 0 0 if (do {
1638 0 194 if do {
1642 0 120 if ($close_status and do {
1647 99 95 unless defined do {
1655 95 93 if (defined $returned_pid and $returned_pid)
1657 0 95 if (do {
1672 0 0 if (do {
1681 0 0 if (defined $returned_pid and $returned_pid)
1683 0 0 if (do {
1702 0 0 if (defined $returned_pid and $returned_pid)
1704 0 0 if (do {
1729 0 151 if defined $Expect::Log_Stdout
1756 0 0 unless defined $s
1784 2 15 unless defined $string
1790 0 7 if defined $self and do {
1792 5 10 $length ? :
1794 7 8 if $length >= length $string
1807 5472 0 if (do {
1809 0 0 unless defined $print_this
1815 0 0 if do {
1822 137 5335 if do {
1836 0 0 unless defined $fcntl_flags
1838 0 0 if ($fcntl_flags | 2) { }
0 0 elsif ($fcntl_flags | 1) { }
1862 0 130 if (do {