Branch Coverage

blib/lib/PAGI/WebSocket.pm
Criterion Covered Total %
branch 108 118 91.5


line true false branch
16 2 145 unless $scope and ref $scope eq "HASH"
18 2 143 unless $receive and ref $receive eq "CODE"
20 2 141 unless $send and ref $send eq "CODE"
23 1 140 unless ($scope->{'type'} // "") eq "websocket"
28 0 140 if $scope->{'pagi.websocket'}
83 0 58 unless defined $str
92 0 50 unless defined $str
93 2 48 $strict ? :
104 1 31 if %opts
106 1 24 $strict ? :
6 25 $raw ? :
107 14 17 if $self->{'scope'}{$cache_key}
113 0 29 unless length $part
123 4 25 $raw ? :
124 4 25 $raw ? :
157 4 16 if (lc $pair->[0] eq $name)
167 1 2 if $self->{'scope'}{'pagi.request.headers'}
225 0 46 if $self->{'_close_callbacks_ran'}
235 11 5 if (builtin::blessed($r) and $r->isa("Future"))
239 1 15 if ($@)
268 3 5 if ($event eq 'message') { }
2 3 elsif ($event eq 'close') { }
2 1 elsif ($event eq 'error') { }
289 2 6 if (builtin::blessed($r) and $r->isa("Future"))
293 1 7 if ($@)
299 1 6 if (not @{$self->{'_on_error'};})
311 2 96 if exists $opts{'subprotocol'}
312 2 96 if exists $opts{'headers'}
325 3 16 if $self->is_closed
346 1 8 if $self->is_closed
360 1 2 if $self->is_closed
374 1 6 if $self->is_closed
390 1 5 if $self->is_closed
398 1 4 if ($@)
407 1 5 if $self->is_closed
415 1 4 if ($@)
424 1 5 if $self->is_closed
433 1 4 if ($@)
444 1 2 unless $self->is_connected
451 1 2 unless $self->is_connected
458 1 2 unless $self->is_connected
468 5 71 if $self->is_closed
473 30 78 if (not defined $event or $event->{'type'} eq "websocket.disconnect")
483 38 40 if $event->{'type'} eq "websocket.connect"
494 13 24 unless $event
497 0 24 unless $event->{'type'} eq "websocket.receive"
498 2 22 unless exists $event->{'text'}
509 2 3 unless $event
512 0 3 unless $event->{'type'} eq "websocket.receive"
513 0 3 unless exists $event->{'bytes'}
523 1 3 unless defined $text
534 0 5 unless $event->{'type'} eq "websocket.receive"
566 4 4 unless defined $text
581 1 15 if (my $err = $@)
585 8 7 unless $event
587 0 7 unless $event->{'type'} eq "websocket.receive"
595 1 4 if (builtin::blessed($r) and $r->isa("Future"))
599 3 5 if (my $err = $@)
619 2 4 if defined $timeout