Branch Coverage

blib/lib/Brannigan/Tree.pm
Criterion Covered Total %
branch 117 128 91.4


line true false branch
51 5 4 if $rejects
74 24 112 if $rules->{'_all'}
76 738 116 unless $param =~ m[^/([^/]+)/$]
78 52 64 if /$re/
80 116 20 if $rules->{$_}
84 68 68 if $rj
89 9 158 if $_ eq '_all'
90 22 136 if m[^/[^/]+/$]
91 7 40 if $rules->{$_}{'required'} and !defined($params->{$_}) || $params->{$_} eq ''
113 22 165 if m[^/[^/]+/$]
114 131 34 unless not defined $params->{$_} or $params->{$_} eq ''
117 3 31 if (exists $param_rules->{$_}{'default'} and ref $param_rules->{$_}{'default'} eq 'CODE') { }
3 28 elsif (exists $param_rules->{$_}{'default'}) { }
127 5 149 if not defined $params->{$_} or $params->{$_} eq ''
132 731 110 unless $p =~ m[^/([^/]+)/$]
134 61 49 unless /$re/
137 131 18 if $param_rules->{$_}
139 2 0 if scalar @refs == 0 and $self->{'ignore_missing'}
140 2 145 unless (scalar @refs and $self->{'ignore_missing'})
147 29 116 if (ref $params->{$_} eq 'HASH') { }
9 107 elsif (ref $params->{$_} eq 'ARRAY') { }
165 484 69 unless $r =~ m[^/([^/]+)/$]
169 26 43 unless scalar @matches > 0
172 6 37 if $param_rules->{$r}{'parse'}
174 11 96 if $param_rules->{$_}{'parse'}
177 17 90 if ($parse and ref $parse eq 'CODE') { }
180 0 17 if (ref $parsed->{$k} eq 'HASH') { }
0 17 elsif (ref $parsed->{$k} eq 'ARRAY') { }
198 7 49 if ($group_rules)
203 8 3 if (exists $group_rules->{$_}{'params'}) { }
3 0 elsif (exists $group_rules->{$_}{'regex'}) { }
209 0 3 unless $re
212 27 12 unless $p =~ /$re/
223 3 5 if (ref $parsed->{$k} eq 'ARRAY') { }
0 5 elsif (ref $parsed->{$k} eq 'HASH') { }
254 2 152 unless $validations
259 2 66 if not $validations->{'required'} and !defined($value) || $value eq ''
260 3 81 if $validations->{'required'} and !defined($value) || $value eq ''
264 1 0 if $validations->{'forbidden'} and defined $value and $value ne ''
267 29 117 if ($validations->{'hash'}) { }
11 106 elsif ($validations->{'array'}) { }
291 23 306 if $v eq 'parse' or $v eq 'default'
292 9 84 if $type and $type eq 'array' and $v eq 'values'
293 29 55 if $type and $type eq 'hash' and $v eq 'keys'
296 69 199 ref $validations->{$v} eq 'ARRAY' ? :
300 18 250 if ($v eq 'validate' and ref $validations->{$v} eq 'CODE') { }
9 241 elsif (exists $self->{'_custom_validations'} and exists $self->{'_custom_validations'}{$v} and ref $self->{'_custom_validations'}{$v} eq 'CODE') { }
302 6 12 unless $validations->{$v}->($value, @data)
305 3 6 unless $self->{'_custom_validations'}{$v}->($value, @data)
308 43 198 unless 'Brannigan::Validations'->$v($value, @data)
312 43 101 scalar @rejects ? :
325 2 9 unless ref $value eq 'ARRAY'
330 0 9 if $_self
336 9 9 if $rj
340 7 2 scalar keys %$rejects ? :
353 0 29 unless ref $value eq 'HASH'
358 0 29 if $_self
367 21 8 scalar keys %$rejects ? :
379 2 217 unless scalar @_ and ref $_[0] eq 'HASH' || ref $_[0] eq 'Brannigan::Tree'
387 0 88 unless ref $_ eq 'HASH'
390 28 53 if (ref $_->{$k} eq 'HASH') { }
391 6 22 if (not exists $tree{$k}) { }
397 2 51 if ($k eq 'forbidden' and $_->{$k}) { }
6 45 elsif ($k eq 'required' and $_->{$k}) { }