Branch Coverage

lib/PAGI/Test/Client.pm
Criterion Covered Total %
branch 124 156 79.4


line true false branch
14 0 76 unless $args{'app'}
63 5 66 if (exists $opts{'json'}) { }
6 60 elsif (exists $opts{'form'}) { }
0 60 elsif (defined $opts{'body'}) { }
94 22 0 unless ($receive_called)
107 57 58 if (($captured{'type'} // "") eq "http.response.body")
108 1 56 if ($method eq 'HEAD') { }
5 51 elsif (exists $captured{'fh'} or exists $captured{'file'}) { }
126 12 57 if ($@)
128 1 11 if ($self->{'raise_app_exceptions'})
142 1 56 unless ($has_response_start)
157 2 69 if ($path =~ s/\?(.*)$//)
162 6 65 if ($opts->{'query'})
171 2 4 $query_string ? :
192 10 59 if $self->{'state'}
209 57 57 if ($type eq 'http.response.start') { }
57 0 elsif ($type eq 'http.response.body') { }
210 1 56 if $response_started
216 0 57 unless $response_started
217 1 56 if $body_complete
222 56 0 unless $more
228 1 56 if (lc $h->[0] eq "set-cookie")
229 1 0 if ($h->[1] =~ /^([^=]+)=([^;]*)/)
245 56 5 if exists $event->{'body'}
247 2 3 if (exists $event->{'file'})
255 3 0 if (exists $event->{'fh'})
269 0 2 unless open my $fh, "<:raw", $path
272 1 1 if $offset
285 1 2 if $offset
300 4 6 if (defined $remaining)
301 2 2 if $remaining <= 0
302 2 0 if $remaining < $to_read
306 0 8 unless defined $bytes_read
308 3 5 if $bytes_read == 0
311 2 3 if defined $remaining
325 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') { }
338 1 13 if ($path =~ s/\?(.*)$//)
352 2 12 if ($opts{'headers'})
366 0 14 if (keys %{$$self{"cookies"};})
385 1 13 if $self->{'state'}
390 10 4 if ($callback)
393 8 2 unless $ws->is_closed
394 0 10 if $err
409 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') { }
422 0 12 if ($path =~ s/\?(.*)$//)
439 2 10 if ($opts{'headers'})
453 0 12 if (keys %{$$self{"cookies"};})
476 1 11 if $self->{'state'}
481 11 1 if ($callback)
484 11 0 unless $sse->is_closed
485 0 11 if $err
494 0 7 if $self->{'started'}
495 0 7 unless $self->{'lifespan'}
509 7 7 if ($phase eq "startup")
521 7 7 if ($event->{'type'} eq 'lifespan.startup.complete') { }
7 0 elsif ($event->{'type'} eq 'lifespan.shutdown.complete') { }
544 0 7 unless $self->{'started'}
545 0 7 unless $self->{'lifespan'}
548 7 0 if ($self->{'lifespan_pending'} and ${$self->{'lifespan_pending'};})
568 0 3 if $err
586 9 13 unless (defined $$headers_ref)
591 9 4 if (ref $$headers_ref eq 'HASH') { }
4 0 elsif (ref $$headers_ref eq 'ARRAY') { }
592 9 0 if ($replace) { }
601 0 8 if (lc $$headers_ref->[$i][0] eq lc $name)
606 0 4 if (defined $found_idx) { }
607 0 0 if $replace
619 53 131 unless defined $input
622 6 125 if (ref $input eq "ARRAY")
625 1 16 unless ref $pair eq "ARRAY" and @$pair == 2
632 124 1 if (ref $input eq "HASH")
636 10 33 if (ref $val eq 'ARRAY') { }
675 3 3 unless $replace_keys{lc $pair->[0]}
684 2 67 if (keys %{$$self{"cookies"};})