Branch Coverage

blib/lib/PAGI/SSE.pm
Criterion Covered Total %
branch 124 178 69.6


line true false branch
17 1 107 unless $scope and ref $scope eq "HASH"
19 1 106 unless $receive and ref $receive eq "CODE"
21 1 105 unless $send and ref $send eq "CODE"
24 1 104 unless ($scope->{'type'} // "") eq "sse"
29 1 103 if $scope->{'pagi.sse'}
57 0 12 unless defined $str
66 0 8 unless defined $str
67 0 8 $strict ? :
78 0 6 if %opts
80 0 4 $strict ? :
2 4 $raw ? :
81 2 4 if $self->{'scope'}{$cache_key}
87 0 6 unless length $part
97 2 4 $raw ? :
98 2 4 $raw ? :
183 1 1 unless $t
190 1 1 unless $t
197 1 1 unless $t
204 1 1 if $t and $t->can("on_high_water")
211 1 1 if $t and $t->can("on_drain")
218 1 2 unless $t
220 0 2 unless defined $high
221 1 1 $t->buffered_amount < $high ? :
237 1 31 if $self->{'_closed_future'} and not $self->{'_closed_future'}->is_ready
245 2 54 if $self->is_started or $self->is_closed
251 2 52 if exists $opts{'headers'}
279 6 9 if (lc $pair->[0] eq $name)
289 0 2 if $self->{'scope'}{'pagi.request.headers'}
316 1 10 if $self->is_closed
319 2 8 unless $self->is_started
333 0 5 if $self->is_closed
335 1 4 unless $self->is_started
351 0 15 if $self->is_closed
352 0 15 unless exists $opts{'data'}
354 7 8 unless $self->is_started
358 13 2 if (ref $data)
367 13 2 if defined $opts{'event'}
368 9 6 if defined $opts{'id'}
369 3 12 if defined $opts{'retry'}
379 1 9 if $self->is_closed
382 0 9 unless $self->is_started
388 7 2 if (my $err = $@)
398 0 2 if $self->is_closed
401 0 2 unless $self->is_started
408 0 2 if (my $err = $@)
420 0 1 if $self->is_closed
422 0 1 unless $self->is_started
434 0 1 if $self->is_closed
437 0 1 unless $self->is_started
443 0 1 if (my $err = $@)
453 0 2 if $self->is_closed
456 0 2 unless $self->is_started
459 0 2 if (ref $data)
467 2 0 if defined $opts{'event'}
468 0 2 if defined $opts{'id'}
469 0 2 if defined $opts{'retry'}
473 0 2 if (my $err = $@)
488 2 4 if (builtin::blessed($r) and $r->isa("Future"))
492 2 5 if ($@)
498 2 5 if (not @{$self->{'_on_error'};})
520 2 2 if ($event eq 'close') { }
1 1 elsif ($event eq 'error') { }
536 0 22 if $self->{'_close_callbacks_ran'}
544 3 13 if (builtin::blessed($r) and $r->isa("Future"))
548 0 16 if ($@)
562 0 11 if $self->is_closed
584 1 12 unless $self->is_started
593 1 12 if (my $err = $@)
598 1 11 if $self->is_closed
602 11 0 if ($type eq "sse.disconnect")
617 1 3 unless $self->is_started
622 3 1 if (ref $source eq 'ARRAY') { }
1 0 elsif (ref $source eq 'CODE') { }
624 0 7 if $self->is_closed
629 2 5 if (ref $result eq "HASH")
638 1 3 unless defined $item
642 0 3 if (ref $result eq "HASH")
659 0 1 unless defined $interval and $interval > 0
660 0 1 unless ref $callback eq "CODE"
663 0 1 unless eval { do { require Future::IO; 1 } }
669 1 0 unless $Future::IO::IMPL
673 0 0 unless $self->is_started
681 0 0 unless ($ok)
694 0 0 if ($self->is_closed)
695 0 0 if $sleep_future->can("cancel") and not $sleep_future->is_ready
701 0 0 if $disconnect_future->can("cancel") and not $disconnect_future->is_ready
718 0 0 unless $event
721 0 0 if ($type eq "sse.disconnect")
722 0 0 if ($weak_self)