Branch Coverage

blib/lib/Switch.pm
Criterion Covered Total %
branch 121 184 65.7


line true false branch
30 3 0 unless @_ > 1 and $_[1] eq 'noimport'
37 2 1 if grep /__/, @_
38 1 2 if grep /Perl\s*6/i, @_
39 2 1 if grep /Perl\s*5/i, @_ or not grep(/Perl\s*6/i, @_)
55 0 5 if $status < 0
57 3 2 if $offset
86 440 11 unless $Perl5 and $source =~ /case|switch/ or $Perl6 and $source =~ /when|given|default/
92 0 2553 if ($source =~ /(\G\s*use\s+Switch\b)/cg)
98 58 2495 if (defined $pos[0])
102 0 58 if (substr($source, $pos[4], $pos[5]) eq '/' and substr($source, $pos[2], $pos[3]) eq '' and index(substr($source, $pos[16], $pos[17]), 'x') == -1 and ($iEol = index($source, "\n", $pos[4])) > 0 and $iEol < $pos[8]) { }
115 2 2493 if ($source =~ /(\G\s*$pod_or_DATA)/cg)
120 162 2331 if (defined $pos[0])
122 44 118 if $pos[0] < $pos[2]
127 20 2311 if ($Perl5 and $source =~ /\G(\n*)(\s*)(switch)\b(?=\s*[(])/cg or $Perl6 and $source =~ /\G(\n*)(\s*)(given)\b(?=\s*[(])/cg or $Perl6 and $source =~ /\G(\n*)(\s*)(given)\b(.*)(?=\{)/cg) { }
212 3160 elsif ($Perl5 and $source =~ /\G(\s*)(case\b)(?!\s*=>)/cg or $Perl6 and $source =~ /\G(\s*)(when\b)(?!\s*=>)/cg or $Perl6 and $source =~ /\G(\s*)(default\b)(?=\s*\{)/cg) { }
134 19 1 unless ($arg)
136 0 19 unless (@pos = &Text::Balanced::_match_codeblock(\$source, qr/\s*/, qr/\(/, qr/\)/, qr/[[{(<]/, qr/[]})>]/, undef))
141 20 0 unless $arg =~ s/^\s*[(]\s*%/ ( \\%/ or $arg =~ s/^\s*[(]\s*m\b/ ( qr/ or $arg =~ s[^\s*[(]\s*/][ ( qr/]
146 0 20 unless (@pos = &Text::Balanced::_match_codeblock(\$source, qr/\s*/, qr/\{/, qr/\}/, qr/\{/, qr/\}/, undef))
159 0 212 $keyword eq 'default' ? :
163 0 212 if ($keyword eq 'default') { }
34 178 elsif (@pos = &Text::Balanced::_match_codeblock(\$source, qr/\s*/, qr/\{/, qr/\}/, qr/\{/, qr/\}/, undef)) { }
155 23 elsif (@pos = &Text::Balanced::_match_codeblock(\$source, qr/\s*/, qr/[[(]/, qr/[])]/, qr/[[({]/, qr/[])}]/, undef)) { }
0 23 elsif ($Perl6 and do { @pos = &Text::Balanced::_match_variable(\$source, qr/\s*/) }) { }
4 19 elsif (@pos = &Text::Balanced::_match_quotelike(\$source, qr/\s*/, 1, 0)) { }
19 0 elsif ($Perl5 and $source =~ /\G\s*(([^\$\@{])[^\$\@{]*)(?=\s*{)/cg or $Perl6 and $source =~ /\G\s*([^;{]*)()/cg) { }
168 34 0 if $pos[0] < $pos[2]
169 30 4 if is_block($code)
174 155 0 unless $code =~ s/^\s*[(]\s*%/ ( \\%/ or $code =~ s/^\s*[(]\s*m\b/ ( qr/ or $code =~ s[^\s*[(]\s*/][ ( qr/]
178 155 0 if $pos[0] < $pos[2]
183 0 0 unless $code =~ s/^\s*%/ %/
185 0 0 if $pos[0] < $pos[2]
191 4 0 unless $code =~ s/^\s*m/ qr/ or $code =~ s[^\s*/][ qr/]
194 4 0 if $pos[0] < $pos[2]
200 0 19 if $2 eq '%'
207 0 212 unless not $Perl6 or $source =~ /\G(\s*)(?=;|\{)/cg
211 2 210 unless (do { @pos = &Text::Balanced::_match_codeblock(\$source, qr/\s*/, qr/\{/, qr/\}/, qr/\{/, qr/\}/, undef) })
212 2 0 if ($source =~ /\G\s*(?=([};]|\Z))/cg)
219 4 206 unless $fallthrough
244 550 408 if @numy <= $j
246 41 917 if $numx and $numy[$j] and $nextx == $nexty or $nextx eq $nexty
256 0 0 @_ == 1 && ref $_[0] eq 'HASH' ? :
262 0 0 @_ == 1 && ref $_[0] eq 'HASH' ? :
268 53 0 @_ ? :
271 6 47 if ($s_ref eq 'CODE') { }
18 29 elsif ($s_ref eq '' and defined $s_val and (~$s_val & $s_val) eq 0) { }
8 21 elsif ($s_ref eq '') { }
16 5 elsif ($s_ref eq 'ARRAY') { }
0 5 elsif ($s_ref eq 'Regexp') { }
4 1 elsif ($s_ref eq 'HASH') { }
1 0 elsif ($s_ref eq 'Switch') { }
275 30 84 if ref $c_val eq 'CODE'
276 30 54 if ref $c_val eq 'ARRAY'
285 45 24 if $c_ref eq '' and defined $c_val and (~$c_val & $c_val) eq 0
288 24 101 if $c_ref eq ''
289 44 57 if $c_ref eq 'ARRAY'
290 24 33 if $c_ref eq 'CODE'
291 9 24 if $c_ref eq 'Switch'
292 0 24 if $c_ref eq 'Regexp'
294 24 0 if $c_ref eq 'HASH'
304 64 72 if $c_ref eq ''
305 24 48 if $c_ref eq 'ARRAY'
306 32 16 if $c_ref eq 'CODE'
307 0 16 if $c_ref eq 'Switch'
308 0 16 if $c_ref eq 'Regexp'
310 16 0 if $c_ref eq 'HASH'
320 37 76 if $c_ref eq ''
321 30 46 if $c_ref eq 'ARRAY'
322 24 22 if $c_ref eq 'CODE'
323 0 22 if $c_ref eq 'Switch'
325 10 12 if $c_ref eq 'Regexp'
327 12 0 if $c_ref eq 'HASH'
337 0 0 if $c_ref eq ''
338 0 0 if $c_ref eq 'ARRAY'
340 0 0 if $c_ref eq 'CODE'
341 0 0 if $c_ref eq 'Switch'
342 0 0 if $c_ref eq 'Regexp'
343 0 0 if $_ =~ /$s_val/
0 0 if $c_ref eq 'HASH'
353 20 48 if $c_ref eq ''
354 20 28 if $c_ref eq 'ARRAY'
356 16 12 if $c_ref eq 'CODE'
357 0 12 if $c_ref eq 'Switch'
358 0 0 if $_ =~ /$c_val/
0 12 if $c_ref eq 'Regexp'
360 12 0 if $c_ref eq 'HASH'
368 0 3 if ref $c_val eq 'Switch'
369 0 3 if ref $c_val eq 'ARRAY'
413 0 3 if $reversed
417 0 3 ref $right eq 'Switch' ? :
421 3 0 ref $left eq 'Switch' ? :
444 0 0 ref $left eq 'Switch' ? :