Branch Coverage

lib/PAGI/Server/EventValidator.pm
Criterion Covered Total %
branch 59 78 75.6


line true false branch
25 7 10 if ($type eq 'http.response.start') { }
7 3 elsif ($type eq 'http.response.body') { }
3 0 elsif ($type eq 'http.response.trailers') { }
42 1 6 unless exists $event->{'status'}
44 2 4 unless defined $event->{'status'} and $event->{'status'} =~ /^\d+$/
47 3 1 if (exists $event->{'headers'} and defined $event->{'headers'})
49 1 2 unless ref $event->{'headers'} eq "ARRAY"
62 2 5 unless $count <= 1
66 1 4 if (exists $event->{'offset'} and defined $event->{'offset'})
68 1 0 unless $event->{'offset'} =~ /^\d+$/
72 1 3 if (exists $event->{'length'} and defined $event->{'length'})
74 1 0 unless $event->{'length'} =~ /^\d+$/
82 2 1 if (exists $event->{'headers'} and defined $event->{'headers'})
84 1 1 unless ref $event->{'headers'} eq "ARRAY"
96 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') { }
114 0 0 if (exists $event->{'headers'} and defined $event->{'headers'})
116 0 0 unless ref $event->{'headers'} eq "ARRAY"
128 2 2 unless $count == 1
136 2 1 if (exists $event->{'code'} and defined $event->{'code'})
138 1 1 unless $event->{'code'} =~ /^\d+$/
147 1 3 unless exists $event->{'interval'}
149 1 2 unless defined $event->{'interval'} and $event->{'interval'} =~ /^[\d.]+$/
160 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') { }
179 0 0 if (exists $event->{'status'} and defined $event->{'status'})
181 0 0 unless $event->{'status'} =~ /^\d+$/
185 0 0 if (exists $event->{'headers'} and defined $event->{'headers'})
187 0 0 unless ref $event->{'headers'} eq "ARRAY"
196 1 3 unless exists $event->{'data'}
198 1 2 unless defined $event->{'data'} and not ref $event->{'data'}
206 1 2 unless exists $event->{'comment'}
208 1 1 unless defined $event->{'comment'} and not ref $event->{'comment'}
216 1 2 unless exists $event->{'interval'}
218 1 1 unless defined $event->{'interval'} and $event->{'interval'} =~ /^[\d.]+$/