Branch Coverage

blib/lib/Routes/Tiny/Pattern.pm
Criterion Covered Total %
branch 108 120 90.0


line true false branch
18 2 69 if (my $arguments = delete $params{'+arguments'})
34 71 0 if $self->{'routes'}
35 0 71 unless defined $self->{'strict_trailing_slash'}
36 0 71 unless defined $self->{'strict_case'}
38 7 64 if (my $methods = $self->{'method'})
39 6 1 unless ref $methods eq 'ARRAY'
59 18 153 unless $self->_match_method($args{'method'})
61 90 63 unless substr($path, 0, 1) eq '/'
63 5 6 if (not $self->{'strict_trailing_slash'} and $path ne '/' and not $path =~ m[/$])
68 61 92 unless @captures
70 85 7 unless $self->{'defaults'}
73 0 89 unless @captures
77 87 2 if (defined $value or not exists $captures->{$capture})
83 2 90 if ($self->{'arguments_push'}) { }
86 0 2 unless $args{'arguments'}
89 2 3 if (exists $arguments->{$key}) { }
90 2 0 unless ref $arguments->{$key} eq 'ARRAY'
91 1 1 ref $value eq 'ARRAY' ? :
100 74 16 unless $args{'arguments'}
101 85 5 unless $self->arguments
112 21 71 if ($self->{'subroutes'})
138 49 37 if ($type eq 'capture') { }
8 29 elsif ($type eq 'glob') { }
29 0 elsif ($type eq 'text') { }
139 8 9 if ($part->{'level'} and exists $params{$name})
143 10 39 unless (exists $params{$name})
145 9 1 if $part->{'level'} and $part->{'level'} > $optional_depth
147 1 0 if (exists $self->{'defaults'} and exists $self->{'defaults'}{$name}) { }
160 3 37 if (defined(my $constraint = $part->{'constraint'}))
161 2 1 unless $param =~ /^ $constraint $/msx
168 3 5 unless (exists $params{$name})
169 1 2 if (exists $self->{'defaults'} and exists $self->{'defaults'}{$name}) { }
1 1 elsif ($part->{'optional'}) { }
193 71 9 if ($path ne '')
201 3 32 if ($parent_pattern)
203 0 3 unless substr($head, -1) eq '/'
208 10 25 if ($path ne '/' and $trailing_slash)
221 142 29 unless defined $methods
223 7 22 unless defined $value
232 0 71 if ref $self->{'pattern'} eq 'Regexp'
235 4 67 unless ($pattern =~ m[ \A ( / | \(/.+?\)\?/ ) ]msx)
249 150 151 if ($pattern =~ m[ \G \/ ]cgmsx) { }
53 98 elsif ($pattern =~ / \G :($TOKEN) /cgmsx) { }
9 89 elsif ($pattern =~ / \G \*($TOKEN) /cgmsx) { }
61 28 elsif ($pattern =~ / \G ($TOKEN) /cgmsx) { }
16 12 elsif ($pattern =~ / \G \( /cgmsx) { }
11 1 elsif ($pattern =~ / \G \)\? /cgmsx) { }
1 0 elsif ($pattern =~ / \G \) /cgmsx) { }
250 79 71 if ($part)
261 4 49 if (exists $self->{'constraints'}{$name}) { }
263 1 3 if (ref $constraint eq 'ARRAY')
272 4 49 $constraint ? :
313 70 203 if ($part->[-1] and substr($pattern, pos $pattern, 1) eq '/')
318 1 70 if ($par_depth != 0)
322 6 0 unless ($self->{'strict_trailing_slash'} or $self->{'subroutes'})
323 2 4 if ($re =~ m[/$]) { }
1 3 elsif ($re =~ /\)\?$/) { }
334 13 57 if ($self->{'subroutes'}) { }
341 68 2 if ($self->{'strict_case'}) { }
348 43 27 if ($part and @$part)