Branch Coverage

blib/lib/IO/Async/Stream.pm
Criterion Covered Total %
branch 156 204 76.4


line true false branch
391 826 17048 if exists $params{$_}
394 1 992 if (exists $params{'read_high_watermark'} or exists $params{'read_low_watermark'})
396 0 1 unless defined $high
399 0 1 unless defined $low
401 0 1 if defined $low and not defined $high
402 0 1 if defined $high and not defined $low
404 0 1 if defined $low and defined $high and $low > $high
412 2 991 if (exists $params{'encoding'})
415 0 2 unless defined $obj
421 5 988 if ($self->loop and $self->read_handle)
422 0 5 unless $self->can_event('on_read')
426 62 931 if ($self->{'autoflush'} and my $write_handle = $self->write_handle)
427 0 62 if $write_handle->blocking
436 592 111 if (defined $self->read_handle)
437 1 591 unless $self->can_event('on_read')
443 39 663 if (not $self->_is_empty)
480 0 0 $set ? :
482 0 0 if $self->read_handle
489 1 0 $set ? :
491 1 0 if $self->read_handle
519 67 156 $set ? :
521 203 20 if $self->write_handle
528 1 0 $set ? :
530 1 0 if $self->write_handle
586 165 8 if $self->_is_empty
606 1 1 if $_->on_error
740 8 158 unless $written
754 12 6 if (ref $head->data eq 'CODE') { }
6 0 elsif (&blessed(scalar $head->data) and $head->data->isa('Future')) { }
756 5 7 unless (defined $data)
757 5 0 if $head->on_flush
761 1 6 if (not ref $data and my $encoding = $self->{'encoding'})
771 2 4 unless ($f->is_ready)
772 0 2 if $head->watching
778 1 3 if (not ref $data and my $encoding = $self->{'encoding'})
801 0 170 if ref $head->data
803 0 170 if ($IO::Async::Debug::DEBUG > 1)
806 0 0 if $IO::Async::Debug::DEBUG_FLAGS{'Sw'}
812 3 167 unless (defined $len)
815 1 2 if ($errno == 11 or $errno == 11)
816 1 0 if $self->{'writeable'}
820 1 2 if _nonfatal_error($errno)
822 0 2 if $IO::Async::Debug::DEBUG > 1
824 1 1 if ($errno == 32)
830 2 0 if $head->on_error
831 1 1 unless $self->maybe_invoke_event('on_write_error', $errno)
837 161 6 if $len
839 3 164 if (my $on_write = $head->on_write)
843 157 10 unless (length $head->data)
844 34 123 if $head->on_flush
856 0 169 if $self->{'stream_closing'}
862 1 168 if not $handle and $self->loop
864 2 166 if (not ref $data and my $encoding = $self->{'encoding'})
873 3 165 if (defined wantarray)
877 0 3 unless my $loop = $self->loop
882 1 0 if $orig_on_flush
888 2 1 unless $f->is_ready
890 0 3 if $orig_on_error
895 168 0 unless defined $write_len
901 0 168 if keys %params
903 36 132 unless $handle
905 104 28 if ($self->{'autoflush'})
908 104 0 if ($self->_is_empty)
922 1 67 unless ($self->{'writeable'})
927 67 1 if $self->{'want'} & 8
928 1 67 if $self->{'want'} & 4
938 51 17 if ($self->_is_empty)
943 8 43 if $self->{'stream_closing'}
957 17 1135 if ($readqueue->[0] and my $on_read = $readqueue->[0]->on_read) { }
964 1 2 if (defined $self->{'read_low_watermark'} and $self->{'at_read_high_watermark'} and length $self->{'readbuff'} < $self->{'read_low_watermark'})
970 1 1151 if (ref $ret eq 'CODE') { }
13 1138 elsif (@$readqueue and not defined $ret) { }
995 942 0 if $self->{'want'} & 1
996 1 941 if $self->{'want'} & 2
1010 6 941 unless (defined $len)
1013 2 4 if _nonfatal_error($errno)
1015 0 4 if $IO::Async::Debug::DEBUG > 1
1017 2 2 unless $self->maybe_invoke_event('on_read_error', $errno)
1021 1 0 if $_->future
1028 0 941 if ($IO::Async::Debug::DEBUG > 1)
1030 0 0 if $IO::Async::Debug::DEBUG_FLAGS{'Sr'}
1033 465 476 if $len
1037 4 937 if (my $encoding = $self->{'encoding'})
1038 3 1 defined $self->{'bytes_remaining'} ? :
1043 465 476 unless $eof
1047 476 465 if ($eof)
1050 467 9 if $self->{'close_on_read_eof'}
1052 0 0 if $_->future
1058 461 4 unless $self->{'read_all'}
1061 1 460 if (defined $self->{'read_high_watermark'} and length $self->{'readbuff'} >= $self->{'read_high_watermark'})
1063 1 0 unless $self->{'at_read_high_watermark'}
1109 1 12 if $self->{'flushing_read'}
1164 0 1 unless my $self = shift()
1193 0 1 if $f->is_cancelled
1208 0 4 if $f->is_cancelled
1209 0 4 unless $eof or length $$buffref >= $len
1231 3 1 unless ref $until
1236 1 4 if $f->is_cancelled
1237 3 1 if ($$buffref =~ /$until/) { }
0 1 elsif ($eof) { }
1268 0 2 if $f->is_cancelled
1269 1 1 unless $eof