Branch Coverage

blib/lib/SQL/SplitStatement.pm
Criterion Covered Total %
branch 170 190 89.4


line true false branch
105 11 42 @_ > 1 ? :
106 3 50 if (exists $parameters->{'keep_terminators'}) { }
15 35 elsif (exists $parameters->{'keep_terminator'}) { }
109 1 2 if exists $parameters->{'keep_terminator'}
114 51 1 unless exists $parameters->{'slash_terminates'}
154 0 75 if (not defined $code) { }
169 758 57336 if $self->_is_comment($token) and not $self->keep_comments
176 26886 30450 if $token =~ /^\s+$/
178 2423 28027 if ($dollar_quote)
179 40 2383 if ($self->_dollar_quote_close_found($token, $dollar_quote))
193 40 30370 if ($prev_token =~ /$AS_RE/ and not $dollar_quote and $dollar_quote = $self->_dollar_quote_open_found($token)) { }
41 30329 elsif ($token =~ /$DELIMITER_RE/ and not $prev_token) { }
2108 28221 elsif ($token eq '(') { }
2108 26113 elsif ($token eq ')') { }
216 25897 elsif ($self->_is_BEGIN_of_block($token, $prev_token)) { }
716 25181 elsif ($token =~ /$CREATE_ALTER_RE/) { }
255 24926 elsif ($token =~ /$PROCEDURE_FUNCTION_RE/ or $token =~ /$BODY_RE/ and $prev_token =~ /$TYPE_RE/) { }
472 24454 elsif ($token =~ /$IS_RE|$AS_RE/) { }
102 24352 elsif ($token =~ /$DECLARE_RE/) { }
33 24319 elsif ($token =~ /$CURSOR_RE/) { }
8 24311 elsif ($token =~ /$GRANT_REVOKE_RE/) { }
252 24059 elsif (defined(my $name = $self->_is_END_of_block($token))) { }
638 23421 elsif ($token =~ /$CRUD_RE/) { }
98 23323 elsif ($inside_crud and my $placeholder_token = $self->_questionmark_placeholder_found($token) || $self->_named_placeholder_found($token) || $self->_dollar_placeholder_found($token)) { }
207 19 22 if $self->_custom_delimiter eq ';'
217 0 216 if $extra_end_found
224 39 677 if ($next_token =~ /$PACKAGE_RE/)
233 226 5 unless ($inside_block or $inside_brackets or $prev_token =~ /$DROP_RE/ or $prev_token =~ /$pre_identifier_RE/)
244 139 10 if ($prev_keyword =~ /$PROCEDURE_FUNCTION_RE|$BODY_RE/ and not $inside_block and not $prev_token =~ /$pre_identifier_RE/)
252 4 468 if $inside_declare and $inside_cursor
257 61 10 unless $inside_block or $prev_token =~ /$pre_identifier_RE/
262 13 0 if $inside_declare and not $prev_token =~ /$DROP_RE/ and not $prev_token =~ /$pre_identifier_RE/
268 8 0 unless $prev_token
273 36 216 unless $inside_block
275 216 36 if $inside_block
277 238 14 unless ($inside_block)
279 91 147 if ($name eq ';')
281 35 56 if ($inside_sub and $inside_is_as) { }
32 24 elsif ($inside_declare) { }
10 14 elsif ($inside_package) { }
284 35 0 if $inside_sub < @sub_names
293 76 51 if ($inside_sub and @sub_names and $name eq $sub_names[-1])
295 76 0 if $inside_sub < @sub_names
298 29 209 if ($inside_package and $name eq $package_name)
315 98 0 if not $self->_custom_delimiter or $self->_custom_delimiter ne $placeholder_token
328 1811 90 if ($terminator_found and $terminator_found == 1 and not $inside_brackets)
332 73 607 if ($inside_sub and not $inside_is_as and not $inside_block)
338 9 344 if ($inside_declare and $inside_cursor and not $inside_is_cursor)
344 413 1398 if $inside_crud
348 29671 739 if $token =~ /\S/ and not $self->_is_comment($token)
353 30337 32 unless ($custom_delimiter_def_found or $terminator_found and $terminator_found == 3)
360 0 1601 if not $terminator_found or $dollar_quote or $inside_brackets or $self->_custom_delimiter
364 673 0 if $terminator_found and $terminator_found == 1 and $inside_block || $inside_sub || $inside_declare || $inside_package || $inside_crud and not $inside_grant_revoke and not $extra_end_found
380 928 73 if $terminator_found == 1 or $terminator_found == 2
418 37 38 if ($self->keep_empty_statements) { }
427 14 543 $terminator->[0] && $terminator->[0] == 3 ? :
431 528 29 unless ($statement =~ /$only_terminator_RE/)
439 41 34 unless ($self->keep_terminators)
442 508 36 if ($terminator->[0])
443 16 492 if ($terminator->[0] == 3) { }
452 40 35 unless ($self->keep_extra_spaces)
482 252 24059 if ($token =~ /$END_RE/ and not defined $next_token && $next_token =~ /$procedural_END_RE/)
487 252 0 defined $next_token ? :
495 66 8306 $token =~ /$dollar_placeholder_RE/ ? :
510 9 8372 $token =~ /^:(?:\d+|[_a-z][_a-z\d]*)$/ ? :
516 23 8381 $token eq '?' ? :
522 295 40 unless $token =~ /^\$/
525 36 4 if $token =~ /^\$$inner_identifier_RE?\$$/
530 0 4 if $token =~ /$dollar_placeholder_RE/
536 0 4 unless $tokens->[1] =~ /^\$/
538 4 0 if $tokens->[0] =~ /^$inner_identifier_RE$/ and $tokens->[1] eq '$'
551 2327 96 unless $token =~ /^\$/
552 36 60 if $token eq $dollar_quote
555 56 4 if $token =~ /$dollar_placeholder_RE/
561 0 4 unless $tokens->[1] =~ /^\$/
563 4 0 if ($dollar_quote eq $token . $tokens->[0] . $tokens->[1])
569 0 0 if ($dollar_quote eq $token . $tokens->[0] . '$')
597 1 40 if ($first_token_in_delimiter =~ /$quoted_RE/) { }
608 40 59 if $tokens->[$_] =~ /^\s+$/
634 32 1407 if ($self->_custom_delimiter eq $token . $lookahead_delimiter) { }
649 1439 21884 if ($self->_custom_delimiter)
652 32 1407 if $self->_is_custom_delimiter($token)
657 19917 1967 if $token ne '/' and $token ne ';'
661 125 1842 if ($token eq '/')
668 97 28 if (not defined $next_token or $next_token eq "\n" or $next_token =~ /^\s+$/ and $next_next_token eq "\n")
673 58 39 if $current_statement =~ /;\s*\n\s*\z/ or $current_statement =~ /\n\s*\.\s*\n\s*\z/
683 27 6 if $self->slash_terminates and $current_statement =~ /\n\s*\z/ and $next_significant_token_idx == -1 || $tokens->[$next_significant_token_idx] ne '(' && !($tokens->[$next_significant_token_idx] =~ /^\d/) && !($tokens->[$next_significant_token_idx] eq '.' && $$tokens[$next_significant_token_idx + 1] =~ /^\d/)
708 1784 58 if $token eq ';' and not $next_code_portion =~ m[\A\s*\n\s*/\s*$]m and not $next_code_portion =~ m[\A\s*\n\s*\.\s*\n\s*/\s*$]m
723 922 929 if /\S/ and not $self->_is_comment($_)
726 26746 25672 if /\S/
727 755 24771 $skiptoken_RE ? :
729 25455 71 if defined $next_significant_token
739 0 0 if /\S/ and not $self->_is_comment($_)
742 36 72 if /\S/
743 0 39 $skiptoken_RE ? :