Branch Coverage

blib/lib/PAGI/Test/Client.pm
Criterion Covered Total %
branch 129 164 78.6


line true false branch
16 0 80 unless $args{'app'}
65 5 70 if (exists $opts{'json'}) { }
6 64 elsif (exists $opts{'form'}) { }
0 64 elsif (defined $opts{'body'}) { }
96 21 0 unless ($receive_called)
109 121 0 if (my $conn = $scope->{'pagi.connection'})
111 61 60 if ($captured{'type'} // "") eq "http.response.start"
114 60 61 if (($captured{'type'} // "") eq "http.response.body")
115 1 59 if ($method eq 'HEAD') { }
5 54 elsif (exists $captured{'fh'} or exists $captured{'file'}) { }
133 13 60 if ($@)
135 1 12 if ($self->{'raise_app_exceptions'})
139 12 0 if (my $conn = $scope->{'pagi.connection'})
153 1 59 unless ($has_response_start)
159 59 0 if (my $conn = $scope->{'pagi.connection'})
172 2 73 if ($path =~ s/\?(.*)$//)
177 6 69 if ($opts->{'query'})
186 2 4 $query_string ? :
208 10 63 if $self->{'state'}
225 60 60 if ($type eq 'http.response.start') { }
60 0 elsif ($type eq 'http.response.body') { }
226 1 59 if $response_started
232 0 60 unless $response_started
233 1 59 if $body_complete
238 59 0 unless $more
244 1 60 if (lc $h->[0] eq "set-cookie")
245 1 0 if ($h->[1] =~ /^([^=]+)=([^;]*)/)
261 59 5 if exists $event->{'body'}
263 2 3 if (exists $event->{'file'})
271 3 0 if (exists $event->{'fh'})
285 0 2 unless open my $fh, "<:raw", $path
288 1 1 if $offset
301 1 2 if $offset
316 4 6 if (defined $remaining)
317 2 2 if $remaining <= 0
318 2 0 if $remaining < $to_read
322 0 8 unless defined $bytes_read
324 3 5 if $bytes_read == 0
327 2 3 if defined $remaining
341 8 6 if (@rest == 1 and ref $rest[0] eq 'CODE') { }
4 2 elsif (@rest % 2 == 0) { }
2 0 elsif (@rest % 2 == 1 and ref $rest[-1] eq 'CODE') { }
354 1 13 if ($path =~ s/\?(.*)$//)
368 2 12 if ($opts{'headers'})
382 0 14 if (keys %{$$self{"cookies"};})
401 1 13 if $self->{'state'}
406 10 4 if ($callback)
409 8 2 unless $ws->is_closed
410 0 10 if $err
425 6 6 if (@rest == 1 and ref $rest[0] eq 'CODE') { }
1 5 elsif (@rest % 2 == 0) { }
5 0 elsif (@rest % 2 == 1 and ref $rest[-1] eq 'CODE') { }
438 0 12 if ($path =~ s/\?(.*)$//)
455 2 10 if ($opts{'headers'})
469 0 12 if (keys %{$$self{"cookies"};})
492 1 11 if $self->{'state'}
497 11 1 if ($callback)
500 11 0 unless $sse->is_closed
501 0 11 if $err
510 0 7 if $self->{'started'}
511 0 7 unless $self->{'lifespan'}
525 7 7 if ($phase eq "startup")
537 7 7 if ($event->{'type'} eq 'lifespan.startup.complete') { }
7 0 elsif ($event->{'type'} eq 'lifespan.shutdown.complete') { }
560 0 7 unless $self->{'started'}
561 0 7 unless $self->{'lifespan'}
564 7 0 if ($self->{'lifespan_pending'} and ${$self->{'lifespan_pending'};})
584 0 3 if $err
602 9 13 unless (defined $$headers_ref)
607 9 4 if (ref $$headers_ref eq 'HASH') { }
4 0 elsif (ref $$headers_ref eq 'ARRAY') { }
608 9 0 if ($replace) { }
617 0 8 if (lc $$headers_ref->[$i][0] eq lc $name)
622 0 4 if (defined $found_idx) { }
623 0 0 if $replace
635 57 135 unless defined $input
638 6 129 if (ref $input eq "ARRAY")
641 1 16 unless ref $pair eq "ARRAY" and @$pair == 2
648 128 1 if (ref $input eq "HASH")
652 10 33 if (ref $val eq 'ARRAY') { }
691 3 3 unless $replace_keys{lc $pair->[0]}
700 2 71 if (keys %{$$self{"cookies"};})