Branch Coverage

blib/lib/Mojolicious/Plugin/CanonicalURL.pm
Criterion Covered Total %
branch 116 124 93.5


line true false branch
27 109 150 if (defined $should_canonicalize_request_config)
37 104 155 if (defined $should_not_canonicalize_request_config)
47 12 247 if $inline_code
49 149 110 unless $path_declared
50 10 249 if ($end_with_slash) { }
85 91 168 if ($canonicalize_before_render)
115 308 0 if (defined $config)
116 0 308 if not defined &Scalar::Util::reftype($config) or &Scalar::Util::reftype($config) ne 'HASH'
120 303 5 if (%$config)
122 131 172 if (exists $config->{'should_canonicalize_request'})
126 125 158 if (exists $config->{'should_not_canonicalize_request'})
133 17 246 if (exists $config->{'inline_code'})
135 4 13 unless not defined &Scalar::Util::reftype($inline_code) and $inline_code
140 184 75 if (exists $config->{'canonicalize_before_render'})
142 1 183 if defined &Scalar::Util::reftype($config->{'canonicalize_before_render'})
146 31 45 if ($captures_allowed and exists $config->{'captures'})
148 1 30 unless %captures
153 2 255 if exists $config->{'captures'}
155 20 235 if (exists $config->{'end_with_slash'})
157 0 20 if defined &Scalar::Util::reftype($end_with_slash)
160 1 254 if keys %$config
184 8 248 unless $config and !$config_reftype && index($config, '/') == 0 || grep({$config_reftype eq $_;} 'ARRAY', 'HASH', 'REGEXP', 'SCALAR', 'CODE')
186 39 209 if (defined $config_reftype and $config_reftype eq 'SCALAR') { }
91 118 elsif (defined $config_reftype and $config_reftype eq 'ARRAY') { }
42 76 elsif (defined $config_reftype and $config_reftype eq 'HASH') { }
189 2 89 unless @$config
192 6 148 unless $_
195 2 63 unless not defined $reftype or $reftype eq 'CODE' or $reftype eq 'HASH' or $reftype eq 'REGEXP' or $reftype eq 'SCALAR'
202 2 144 if not defined $reftype and index($_, '/') != 0
205 24 120 if (defined $reftype and $reftype eq 'SCALAR')
209 37 107 if (defined $reftype and $reftype eq 'HASH')
223 4 75 unless exists $copy{'starts_with'}
224 4 71 unless defined $copy{'starts_with'}
226 4 67 if defined &Scalar::Util::reftype($copy{'starts_with'})
228 4 63 unless index(delete $copy{'starts_with'}, '/') == 0
229 4 59 if %copy
246 109 104 $should_canonicalize_request ? :
248 23 190 if (not defined $reftype) { }
18 172 elsif ($reftype eq 'REGEXP') { }
39 133 elsif ($reftype eq 'SCALAR') { }
32 101 elsif ($reftype eq 'CODE') { }
32 69 elsif ($reftype eq 'HASH') { }
252 23 0 unless ($path_with_no_slashes_at_the_end_declared)
253 23 0 unless ($path_declared)
263 12 6 unless ($path_declared)
272 27 12 unless $code =~ /\A\s*return/
273 29 10 unless $code =~ /;\s*\z/
275 0 39 unless $code =~ /return\s+\$next->\(\)/
285 32 0 unless ($path_declared)
294 32 37 if (grep {not defined &Scalar::Util::reftype($_);} @$config and not $path_with_no_slashes_at_the_end_declared)
295 32 0 unless ($path_declared)
304 37 32 unless ($path_declared)
307 11 36 if ($reftype eq 'REGEXP' or $reftype eq 'HASH')
315 37 32 if $should_canonicalize_request
320 32 102 if (not defined $reftype_of_item) { }
12 90 elsif ($reftype_of_item eq 'CODE') { }
27 63 elsif ($reftype_of_item eq 'HASH') { }
39 24 elsif ($reftype_of_item eq 'REGEXP') { }
346 72 62 if ($should_canonicalize_request) { }
347 35 37 if $index != 0
354 37 32 if $should_canonicalize_request
361 240 229 shift() ? :