Branch Coverage

blib/lib/PAGI/Server/EventValidator.pm
Criterion Covered Total %
branch 59 94 62.7


line true false branch
28 7 10 if ($type eq 'http.response.start') { }
7 3 elsif ($type eq 'http.response.body') { }
3 0 elsif ($type eq 'http.response.trailers') { }
45 1 6 unless exists $event->{'status'}
47 2 4 unless defined $event->{'status'} and $event->{'status'} =~ /^\d+$/
50 3 1 if (exists $event->{'headers'} and defined $event->{'headers'})
52 1 2 unless ref $event->{'headers'} eq "ARRAY"
65 2 5 unless $count <= 1
69 1 4 if (exists $event->{'offset'} and defined $event->{'offset'})
71 1 0 unless $event->{'offset'} =~ /^\d+$/
75 1 3 if (exists $event->{'length'} and defined $event->{'length'})
77 1 0 unless $event->{'length'} =~ /^\d+$/
85 2 1 if (exists $event->{'headers'} and defined $event->{'headers'})
87 1 1 unless ref $event->{'headers'} eq "ARRAY"
99 0 11 if ($type eq 'websocket.accept') { }
4 7 elsif ($type eq 'websocket.send') { }
3 4 elsif ($type eq 'websocket.close') { }
4 0 elsif ($type eq 'websocket.keepalive') { }
0 0 elsif ($type eq 'websocket.http.response.start') { }
0 0 elsif ($type eq 'websocket.http.response.body') { }
123 0 0 if (exists $event->{'headers'} and defined $event->{'headers'})
125 0 0 unless ref $event->{'headers'} eq "ARRAY"
137 2 2 unless $count == 1
145 2 1 if (exists $event->{'code'} and defined $event->{'code'})
147 1 1 unless $event->{'code'} =~ /^\d+$/
156 1 3 unless exists $event->{'interval'}
158 1 2 unless defined $event->{'interval'} and $event->{'interval'} =~ /^[\d.]+$/
166 0 0 unless exists $event->{'status'}
168 0 0 unless defined $event->{'status'} and $event->{'status'} =~ /^\d+$/
171 0 0 if (exists $event->{'headers'} and defined $event->{'headers'})
173 0 0 unless ref $event->{'headers'} eq "ARRAY"
181 0 0 if (exists $event->{'more'} and defined $event->{'more'})
183 0 0 unless $event->{'more'} =~ /^\d+$/
195 0 10 if ($type eq 'sse.start') { }
4 6 elsif ($type eq 'sse.send') { }
3 3 elsif ($type eq 'sse.comment') { }
3 0 elsif ($type eq 'sse.keepalive') { }
214 0 0 if (exists $event->{'status'} and defined $event->{'status'})
216 0 0 unless $event->{'status'} =~ /^\d+$/
220 0 0 if (exists $event->{'headers'} and defined $event->{'headers'})
222 0 0 unless ref $event->{'headers'} eq "ARRAY"
231 1 3 unless exists $event->{'data'}
233 1 2 unless defined $event->{'data'} and not ref $event->{'data'}
241 1 2 unless exists $event->{'comment'}
243 1 1 unless defined $event->{'comment'} and not ref $event->{'comment'}
251 1 2 unless exists $event->{'interval'}
253 1 1 unless defined $event->{'interval'} and $event->{'interval'} =~ /^[\d.]+$/