Branch Coverage

blib/lib/SQL/SplitStatement.pm
Criterion Covered Total %
branch 171 190 90.0


line true false branch
105 11 45 @_ > 1 ? :
106 3 53 if (exists $parameters->{'keep_terminators'}) { }
15 38 elsif (exists $parameters->{'keep_terminator'}) { }
109 1 2 if exists $parameters->{'keep_terminator'}
114 54 1 unless exists $parameters->{'slash_terminates'}
154 0 78 if (not defined $code) { }
169 758 57431 if $self->_is_comment($token) and not $self->keep_comments
176 26914 30517 if $token =~ /^\s+$/
178 2435 28082 if ($dollar_quote)
179 41 2394 if ($self->_dollar_quote_close_found($token, $dollar_quote))
193 41 30435 if ($prev_token =~ /$AS_RE/ and not $dollar_quote and $dollar_quote = $self->_dollar_quote_open_found($token)) { }
41 30394 elsif ($token =~ /$DELIMITER_RE/ and not $prev_token) { }
2113 28281 elsif ($token eq '(') { }
2113 26168 elsif ($token eq ')') { }
216 25952 elsif ($self->_is_BEGIN_of_block($token, $prev_token)) { }
717 25235 elsif ($token =~ /$CREATE_ALTER_RE/) { }
256 24979 elsif ($token =~ /$PROCEDURE_FUNCTION_RE/ or $token =~ /$BODY_RE/ and $prev_token =~ /$TYPE_RE/) { }
473 24506 elsif ($token =~ /$IS_RE|$AS_RE/) { }
102 24404 elsif ($token =~ /$DECLARE_RE/) { }
33 24371 elsif ($token =~ /$CURSOR_RE/) { }
8 24363 elsif ($token =~ /$GRANT_REVOKE_RE/) { }
252 24111 elsif (defined(my $name = $self->_is_END_of_block($token))) { }
680 23431 elsif ($token =~ /$CRUD_RE/) { }
104 23327 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 678 if ($next_token =~ /$PACKAGE_RE/)
233 227 5 unless ($inside_block or $inside_brackets or $prev_token =~ /$DROP_RE/ or $prev_token =~ /$pre_identifier_RE/)
244 140 10 if ($prev_keyword =~ /$PROCEDURE_FUNCTION_RE|$BODY_RE/ and not $inside_block and not $prev_token =~ /$pre_identifier_RE/)
252 4 469 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 104 0 if not $self->_custom_delimiter or $self->_custom_delimiter ne $placeholder_token
328 1815 90 if ($terminator_found and $terminator_found == 1 and not $inside_brackets)
332 73 608 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 447 1368 if $inside_crud
348 29737 739 if $token =~ /\S/ and not $self->_is_comment($token)
353 30403 32 unless ($custom_delimiter_def_found or $terminator_found and $terminator_found == 3)
360 0 1604 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 931 73 if $terminator_found == 1 or $terminator_found == 2
418 37 41 if ($self->keep_empty_statements) { }
427 14 549 $terminator->[0] && $terminator->[0] == 3 ? :
431 531 32 unless ($statement =~ /$only_terminator_RE/)
439 44 34 unless ($self->keep_terminators)
442 511 36 if ($terminator->[0])
443 16 495 if ($terminator->[0] == 3) { }
452 43 35 unless ($self->keep_extra_spaces)
482 252 24111 if ($token =~ /$END_RE/ and not defined $next_token && $next_token =~ /$procedural_END_RE/)
487 252 0 defined $next_token ? :
495 66 8830 $token =~ /$dollar_placeholder_RE/ ? :
510 9 8896 $token =~ /^:(?:\d+|[_a-z][_a-z\d]*)$/ ? :
516 29 8905 $token eq '?' ? :
522 295 41 unless $token =~ /^\$/
525 33 8 if $token =~ /^\$$inner_identifier_RE?\$$/
530 0 8 if $token =~ /$dollar_placeholder_RE/
536 0 8 unless $tokens->[1] =~ /^\$/
538 8 0 if $tokens->[0] =~ /^$inner_identifier_RE$/ and $tokens->[1] eq '$'
551 2337 98 unless $token =~ /^\$/
552 33 65 if $token eq $dollar_quote
555 56 9 if $token =~ /$dollar_placeholder_RE/
561 1 8 unless $tokens->[1] =~ /^\$/
563 8 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 21888 if ($self->_custom_delimiter)
652 32 1407 if $self->_is_custom_delimiter($token)
657 19917 1971 if $token ne '/' and $token ne ';'
661 125 1846 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 1788 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 923 930 if /\S/ and not $self->_is_comment($_)
726 26796 25692 if /\S/
727 756 24824 $skiptoken_RE ? :
729 25506 74 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 ? :