Branch Coverage

blib/lib/PAGI/WebSocket.pm
Criterion Covered Total %
branch 101 112 90.1


line true false branch
16 2 103 unless $scope and ref $scope eq "HASH"
18 2 101 unless $receive and ref $receive eq "CODE"
20 2 99 unless $send and ref $send eq "CODE"
23 1 98 unless ($scope->{'type'} // "") eq "websocket"
28 0 98 if $scope->{'pagi.websocket'}
89 0 46 unless defined $str
98 0 42 unless defined $str
99 2 40 $strict ? :
110 1 25 if %opts
112 1 20 $strict ? :
4 21 $raw ? :
113 12 13 if $self->{'scope'}{$cache_key}
119 0 23 unless length $part
129 2 21 $raw ? :
130 2 21 $raw ? :
163 4 16 if (lc $pair->[0] eq $name)
173 1 1 if $self->{'scope'}{'pagi.request.headers'}
231 0 32 if $self->{'_close_callbacks_ran'}
241 11 2 if (builtin::blessed($r) and $r->isa("Future"))
245 1 12 if ($@)
269 3 5 if ($event eq 'message') { }
2 3 elsif ($event eq 'close') { }
2 1 elsif ($event eq 'error') { }
289 0 5 if ($@)
295 1 4 if (not @{$self->{'_on_error'};})
307 1 65 if exists $opts{'subprotocol'}
308 1 65 if exists $opts{'headers'}
321 3 12 if $self->is_closed
342 1 5 if $self->is_closed
356 1 1 if $self->is_closed
370 1 5 if $self->is_closed
386 1 3 if $self->is_closed
394 1 2 if ($@)
403 1 3 if $self->is_closed
411 1 2 if ($@)
420 1 3 if $self->is_closed
429 1 2 if ($@)
440 1 1 unless $self->is_connected
447 1 1 unless $self->is_connected
454 1 1 unless $self->is_connected
464 5 47 if $self->is_closed
469 20 54 if (not defined $event or $event->{'type'} eq "websocket.disconnect")
479 27 27 if $event->{'type'} eq "websocket.connect"
490 10 17 unless $event
493 0 17 unless $event->{'type'} eq "websocket.receive"
494 2 15 unless exists $event->{'text'}
505 1 1 unless $event
508 0 1 unless $event->{'type'} eq "websocket.receive"
509 0 1 unless exists $event->{'bytes'}
519 1 2 unless defined $text
530 0 3 unless $event->{'type'} eq "websocket.receive"
562 3 3 unless defined $text
576 0 5 unless $event->{'type'} eq "websocket.receive"
584 1 4 if (builtin::blessed($r) and $r->isa("Future"))
588 1 5 if ($@)
608 1 4 if defined $timeout