Branch Coverage

blib/lib/Search/Tools/Snipper.pm
Criterion Covered Total %
branch 73 160 45.6


line true false branch
104 5 26 if ($self->query->qp->stemmer)
125 0 33 unless (defined $text)
133 2 31 if (length $text < $self->max_chars and not $self->ignore_length)
134 2 0 if ($self->show)
135 0 2 if ($self->strip_markup)
143 1 30 if ($self->strip_markup)
147 31 0 if ($self->collapse_whitespace)
157 0 31 if $self->debug
160 1 30 if (length $s > $self->max_chars * 4 and not $self->ignore_length) { }
1 29 elsif (not length $s || $self->ignore_length) { }
162 0 1 if $self->debug
166 0 1 if $self->debug
172 31 0 if ($self->collapse_whitespace)
183 0 30 if $self->debug
185 1 29 $self->{'use_pp'} ? :
193 5 25 if ($self->query->qp->stemmer)
207 0 30 unless scalar @{$tokens->get_heat;}
223 0 30 if $self->debug
228 29 1 if ($heatmap->has_spans) { }
234 0 58 if $self->debug
238 5 24 if ($#snips > $occur_index)
244 13 16 if ($self->{'as_sentences'})
251 25 4 if ($_[0] ne $snip) { }
252 0 25 if $self->debug
253 10 15 $snips_start_with_query ? :
7 18 $snips_end_with_query ? :
297 20 5 if ($size > $len)
313 26 8 if ($last_ending and $start < $last_ending)
320 23 11 if ($pos > $end or $pos < $start)
329 1 10 if ($start <= 0) { }
2 8 elsif ($end > $len) { }
330 0 1 if $seen_start++
338 0 2 if $seen_end++
364 0 0 if $self->debug
369 0 0 unless $txt =~ /$regexp/
387 0 0 if ($debug > 1)
388 0 0 if $count % 2
393 0 0 if $count < $start_again
401 0 0 if ($w =~ /^$regexp$/)
403 0 0 if ($debug > 1)
410 0 0 if $before < 0
412 0 0 if $after > $#words
414 0 0 if ($debug > 1)
422 0 0 if ($this_snip_matches)
431 0 0 unless $count == $#words
433 0 0 if ($debug > 1)
450 0 0 if ($debug > 1)
461 0 0 if ($last_snip > $#snips)
467 0 0 if $self->debug
470 0 0 if $first_match
497 0 1 if $self->debug
502 1 0 if $self->_re_match(\$text, $self->query->regex_for($q)->plain, \$total, $snips{$q}, \%ranges, $Nchar, $snip_per_q, \$snip_starts_with_query)
505 0 0 if $self->debug
509 0 0 unless ($self->_re_match(\$text, $self->query->regex_for($q)->html, \$total, $snips{$q}, \%ranges, $Nchar, $snip_per_q, \$snip_starts_with_query))
518 0 0 if $self->debug
523 0 1 unless $total
545 0 1 if $self->debug
548 1 0 unless $snip_starts_with_query
549 1 0 unless $text =~ /^\Q$snips[0]\E/i
550 1 0 unless $text =~ /\Q$snips[-1]$\E/i
574 0 1 if ($self->debug)
588 0 1 if ($self->debug)
598 0 0 if ($self->debug and exists $ranges->{$pos})
602 0 1 if exists $ranges->{$pos}
605 0 1 if $start_match < 0
607 0 1 if $start_match == 0
610 0 1 if $self->debug
614 0 1 $start_match < $Nchar ? :
633 0 1 if ($self->debug)
656 0 1 unless ($prefix =~ /^\s/ or substr($$text, $prefix_start - 1, 1) =~ /(\s)/)
676 1 0 unless ($suffix =~ /\s$/ or substr($$text, $end, 1) =~ /(\s)/)
692 1 0 unless ($self->escape)
702 0 0 if scalar @l == scalar @r
708 0 0 if $prefix_start <= 0
709 0 0 if $sanity++ > 100
720 0 0 if ++$end > $t_len
721 0 0 if $sanity++ > 100
741 1 0 if $cnt >= $max_snips
752 2 1 unless $self->show
777 0 31 if ($_[0]->escape) { }