Branch Coverage

blib/lib/Routes/Tiny/Pattern.pm
Criterion Covered Total %
branch 105 116 90.5


line true false branch
18 2 65 if (my $arguments = delete $params{'+arguments'})
33 67 0 if $self->{'routes'}
34 0 67 unless defined $self->{'strict_trailing_slash'}
36 7 60 if (my $methods = $self->{'method'})
37 6 1 unless ref $methods eq 'ARRAY'
57 18 141 unless $self->_match_method($args{'method'})
59 88 53 unless substr($path, 0, 1) eq '/'
61 5 6 if (not $self->{'strict_trailing_slash'} and $path ne '/' and not $path =~ m[/$])
66 57 84 unless @captures
68 77 7 unless $self->{'defaults'}
71 0 89 unless @captures
75 87 2 if (defined $value or not exists $captures->{$capture})
81 2 82 if ($self->{'arguments_push'}) { }
84 0 2 unless $args{'arguments'}
87 2 3 if (exists $arguments->{$key}) { }
88 2 0 unless ref $arguments->{$key} eq 'ARRAY'
89 1 1 ref $value eq 'ARRAY' ? :
98 68 14 unless $args{'arguments'}
99 77 5 unless $self->arguments
110 19 65 if ($self->{'subroutes'})
136 49 37 if ($type eq 'capture') { }
8 29 elsif ($type eq 'glob') { }
29 0 elsif ($type eq 'text') { }
137 8 9 if ($part->{'level'} and exists $params{$name})
141 10 39 unless (exists $params{$name})
143 9 1 if $part->{'level'} and $part->{'level'} > $optional_depth
145 1 0 if (exists $self->{'defaults'} and exists $self->{'defaults'}{$name}) { }
158 3 37 if (defined(my $constraint = $part->{'constraint'}))
159 2 1 unless $param =~ /^ $constraint $/msx
166 3 5 unless (exists $params{$name})
167 1 2 if (exists $self->{'defaults'} and exists $self->{'defaults'}{$name}) { }
1 1 elsif ($part->{'optional'}) { }
191 71 9 if ($path ne '')
199 3 32 if ($parent_pattern)
201 0 3 unless substr($head, -1) eq '/'
206 10 25 if ($path ne '/' and $trailing_slash)
219 130 29 unless defined $methods
221 7 22 unless defined $value
230 0 67 if ref $self->{'pattern'} eq 'Regexp'
233 4 63 unless ($pattern =~ m[ \A ( / | \(/.+?\)\?/ ) ]msx)
247 142 147 if ($pattern =~ m[ \G \/ ]cgmsx) { }
53 94 elsif ($pattern =~ / \G :($TOKEN) /cgmsx) { }
9 85 elsif ($pattern =~ / \G \*($TOKEN) /cgmsx) { }
57 28 elsif ($pattern =~ / \G ($TOKEN) /cgmsx) { }
16 12 elsif ($pattern =~ / \G \( /cgmsx) { }
11 1 elsif ($pattern =~ / \G \)\? /cgmsx) { }
1 0 elsif ($pattern =~ / \G \) /cgmsx) { }
248 75 67 if ($part)
259 4 49 if (exists $self->{'constraints'}{$name}) { }
261 1 3 if (ref $constraint eq 'ARRAY')
270 4 49 $constraint ? :
311 66 195 if ($part->[-1] and substr($pattern, pos $pattern, 1) eq '/')
316 1 66 if ($par_depth != 0)
320 6 0 unless ($self->{'strict_trailing_slash'} or $self->{'subroutes'})
321 2 4 if ($re =~ m[/$]) { }
1 3 elsif ($re =~ /\)\?$/) { }
332 12 54 if ($self->{'subroutes'}) { }
339 43 23 if ($part and @$part)