Branch Coverage

blib/lib/Elasticsearch/Compat/QueryParser.pm
Criterion Covered Total %
branch 153 160 95.6


line true false branch
59 0 194 unless defined $text
74 8 136 unless $$self{'_done'} or $$opts{'fix'}
77 58 136 if ($@)
90 0 0 unless defined $text
107 883 257 if $next
181 255 856 unless my $token = $self->_next_token
185 666 190 if ($$allowed{$type}) { }
17 173 elsif (defined $$allowed{$type}) { }
186 160 506 if $type eq '_SPACE'
190 8 9 unless $$self{'_opts'}{'fix'}
207 173 292 unless (defined $clause)
209 143 9 if @{$$self{'_stack'};} > 1 or not $$self{'_opts'}{'fix'} or $$self{'_done'}
215 28 264 unless length $clause
229 8 37 unless ($$self{'_stack'}[-1]{'clauses'})
230 4 4 if $$opts{'fix'}
233 3 34 unless ($$opts{'allow_bool'})
234 1 2 unless $$opts{'fix'}
239 26 4 if defined $next and length $next
242 2 2 if $$opts{'fix'}
253 3 24 unless ($$opts{'allow_bool'})
254 1 2 unless $$opts{'fix'}
259 4 17 unless defined $next
261 1 20 if $next =~ s/^[+-]+// and not $$opts{'fix'}
264 16 4 if length $next
267 2 2 if $$opts{'fix'}
278 17 3 if defined $next and length $next
280 2 1 if $$self{'_opts'}{'fix'}
293 18 2 if ($rparen and $$rparen[0] eq '_RPAREN') { }
1 1 elsif ($$self{'_opts'}{'fix'}) { }
295 7 11 if $next
304 19 0 $clause ? :
311 7 39 unless ($$self{'_opts'}{'allow_boost'})
312 3 4 unless $$self{'_opts'}{'fix'}
316 4 35 unless (defined $val and length $val)
317 2 2 if $$self{'_opts'}{'fix'}
331 21 19 if ($$self{'current'} eq '_PHRASE') { }
334 17 4 if ($$opts{'allow_slop'}) { }
336 11 6 $fuzzy ? :
339 2 2 unless $fix
346 15 4 if ($$opts{'allow_fuzzy'}) { }
347 11 4 if (defined $fuzzy) { }
348 9 2 if ($fuzzy <= 1) { }
352 1 1 unless $fix
362 2 2 unless $fix
393 5 9 unless ($$opts{'fields'} and !ref($$opts{'fields'}) || $$opts{'fields'}{$field})
396 3 2 if $$opts{'fix'}
400 6 3 if $field
402 2 1 if $$self{'_opts'}{'fix'}
415 0 18 unless (defined $next and length $next)
416 0 0 unless $$opts{'fix'}
421 8 8 if $$opts{'fields'} and !ref($$opts{'fields'}) || $$opts{'fields'}{$field}
425 5 5 unless $$opts{'fix'}
447 5 8 unless ($term =~ /^[^*?]{$min}/)
448 1 1 $min == 1 ? :
2 3 unless $$self{'_opts'}{'fix'}
453 1 2 unless length $term
465 2 24 unless ($$opts{'allow_ranges'})
466 1 1 unless $$opts{'fix'}
470 4 20 unless (defined $to)
471 2 2 unless $$opts{'fix'}
482 5 5 unless $$self{'_opts'}{'fix'}
484 1 4 $$self{'_opts'}{'escape_reserved'} ? :
493 1 1 unless $$self{'_opts'}{'fix'}
519 180 866 if $text =~ /\G$WS/cg
521 61 805 if $text =~ /\G(AND\b | && | OR\b | \|{2})/cgx
523 31 774 if $text =~ /\G(NOT\b | !)/cgx
525 26 748 if $text =~ /\G([-+])/cg
527 21 727 if $text =~ /\G[(]/cg
529 21 706 if $text =~ /\G[)]/cg
531 52 654 if $text =~ /\G\^($DECIMAL)?/cg
533 51 603 if $text =~ /\G[~]($DECIMAL)?/cg
535 29 574 if $text =~ /\G " ( (?: $ESC_CHAR | [^"\\])*) "/cgx
537 16 558 if $text =~ /\G (_exists_|_missing_): ((?:$TERM_START_CHAR $TERM_CHAR*)?) /cgx
542 19 539 if $text =~ /\G ($TERM_START_CHAR $TERM_CHAR*):/cgx
544 201 338 if $text =~ /\G ( $TERM_START_CHAR $TERM_CHAR*) (?!$TERM_CHAR | [*?]) /cgx
549 17 321 if $text =~ /\G ( (?:$TERM_START_CHAR | [*?]) (?:$TERM_CHAR | [*?])* )/cgx
554 28 293 if $text =~ /\G \[ ( $QUOTE_RANGE | [^ \]]+ ) (?: $RANGE_SEP ( $QUOTE_RANGE | [^ \]]* ) )? \] /cgx
562 2 291 if $text =~ /\G \{ ( $QUOTE_RANGE | [^ }]+ ) (?: $RANGE_SEP ( $QUOTE_RANGE | [^ }]* ) )? \} /cgx
572 18 273 if $text =~ /\G ( ["&|!(){}[\]~^:+\-] )/cgx
575 3 270 if $text =~ /\G\\$/cg