Branch Coverage

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


line true false branch
18 2 64 if (my $arguments = delete $params{'+arguments'})
33 66 0 if $self->{'routes'}
34 0 66 unless defined $self->{'strict_trailing_slash'}
36 6 60 if (my $methods = $self->{'method'})
37 5 1 unless ref $methods eq 'ARRAY'
57 12 137 unless $self->_match_method($args{'method'})
59 84 53 unless substr($path, 0, 1) eq '/'
61 5 6 if (not $self->{'strict_trailing_slash'} and $path ne '/' and not $path =~ m[/$])
66 54 83 unless @captures
68 76 7 unless $self->{'defaults'}
71 0 88 unless @captures
75 86 2 if (defined $value or not exists $captures->{$capture})
81 2 81 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 67 14 unless $args{'arguments'}
99 76 5 unless $self->arguments
110 19 64 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 128 21 unless defined $methods
221 3 18 unless defined $value
230 0 66 if ref $self->{'pattern'} eq 'Regexp'
233 4 62 unless ($pattern =~ m[ \A ( / | \(/.+?\)\?/ ) ]msx)
247 140 145 if ($pattern =~ m[ \G \/ ]cgmsx) { }
52 93 elsif ($pattern =~ / \G :($TOKEN) /cgmsx) { }
9 84 elsif ($pattern =~ / \G \*($TOKEN) /cgmsx) { }
56 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 74 66 if ($part)
259 4 48 if (exists $self->{'constraints'}{$name}) { }
261 1 3 if (ref $constraint eq 'ARRAY')
270 4 48 $constraint ? :
311 65 192 if ($part->[-1] and substr($pattern, pos $pattern, 1) eq '/')
316 1 65 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 53 if ($self->{'subroutes'}) { }
339 42 23 if ($part and @$part)