Branch Coverage

lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm
Criterion Covered Total %
branch 152 272 55.8


line true false branch
107 0 15 unless ($main->{'base_extract'})
110 0 15 if $self->{'show_progress'}
136 0 15 if $self->{'show_progress'}
148 0 15 if $self->{'show_progress'}
155 0 15 if ($self->{'main'}{'bases_cache_dir'})
163 0 42 if $self->{'show_progress'} and $progress
167 0 42 unless (defined $rule)
173 0 42 if (defined $cent)
174 0 0 if (defined $cent->{'g'}) { }
197 42 0 unless ($is_a_replacetags_rule)
203 2 40 unless (eval { do { my($qr, $mods) = $self->simplify_and_qr_regexp($rule); ($lossy, @bases) = $self->extract_hints($rule, $qr, $mods); 1 } })
204 2 0 $@ ne '' ? :
218 3 132 if ($len < $min_chars) { }
62 70 elsif (not defined $minlen or $len < $minlen) { }
223 5 37 if ($is_a_replacetags_rule or not $minlen or not @bases) { }
224 5 0 !@bases ? :
0 5 $is_a_replacetags_rule ? :
239 4 2520 if ($base1 ne $base2 and $base1 =~ /\Q$base2\E/)
247 4 128 if $subsumed{$base}
262 0 15 if $self->{'show_progress'} and $progress
304 0 15 if $self->{'show_progress'}
315 0 128 unless $base and $set1->{'name'}
327 0 109 unless $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::b->[3] <=> $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::a->[3] or $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::a->[0] cmp $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::b->[0] or $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::a->[1] cmp $Mail::SpamAssassin::Plugin::BodyRuleBaseExtractor::b->[1]
338 0 128 if $self->{'show_progress'} and $progress
339 24 104 unless my $base1 = $set1->[0]
348 24 17 if (not $set2->[0] or $base1 eq $set2->[0] and $name1 eq $set2->[1] and $orig1 eq $set2->[2])
362 1628 33 if index($base1, $set2->[4]) == -1
367 0 0 if $set2->[5] and index($set2->[1], $name1) > -1 and $set2->[1] =~ /(?: |^)\Q$name1\E(?: |$)/
371 0 11 if $set1->[5] and index($set1->[1], $set2->[1]) > -1 and $set1->[1] =~ /(?: |^)\Q$set2->[1]\E(?: |$)/
386 24 104 unless $base
388 12 92 if (defined $bases{$base}) { }
401 17 120 if exists $u{$i}
406 0 15 if $self->{'show_progress'} and $progress
408 0 15 if ($cachefile)
414 0 15 if $self->{'show_progress'}
455 37 5 if ($main->{'bases_must_be_casei'}) { }
459 19 18 if $mods =~ s/i//
462 1 36 if $rule =~ s/(?<!\\)\(\?i\:(.*?)\)/$1/gs
465 0 37 if $rule =~ s/(?<!\\)\(\?-i\:(.*?)\)/$1/gs
471 0 5 if $rule =~ /\(\?i\)/
472 1 4 if $mods =~ /i/
475 0 4 if $rule =~ s/(?<!\\)\(\?i\:(.*?)\)/$1/gs
482 0 41 if $mods =~ s/m//
483 2 39 if $mods =~ s/s//
487 0 41 if $rule =~ s/\(\^\|\\b\)//gs
488 0 41 if $rule =~ s/\(\$\|\\b\)//gs
489 0 41 if $rule =~ s/\(\\b\|\^\)//gs
490 0 41 if $rule =~ s/\(\\b\|\$\)//gs
493 1 40 if $rule =~ s/\(\?\![^\)]+\)//gs
496 5 36 if $rule =~ s/(?<!\\)\\b//gs
502 26 15 if $lossy
516 26 15 if $mods =~ s/L//
520 0 41 if $rule =~ /^\(?(?:\^|\\A)/
525 0 41 if $rule =~ s/(?<!\\)(?:\$|\\Z)\)?$//
529 41 0 unless $main->{'bases_allow_noncapture_groups'}
538 0 41 unless $tmpfh
541 0 41 unless print $tmpfh 'use bytes; m{' . $rule . '}' . $mods
543 0 41 unless close $tmpfh
547 0 41 unless open IN, "$perl -c -Mre=debug $tmpf 2>&1 |"
552 0 41 unless defined $nread
554 0 41 unless unlink $tmpf
555 0 41 unless close IN
556 0 41 unless defined $fullstr
570 0 41 unless ($fullstr =~ /((?:\s[^\n]+\n)+)/m)
589 0 439 unless $op
591 321 118 if ($op =~ /^\s+\d+: (\s*)([A-Z]\w+)\b(.*?)\s*(?:\(\d+\))?$/) { }
4 114 elsif ($op =~ /^ (\s*)<(.*)>\.\.\.\s*$/) { }
114 0 elsif ($op =~ /^ (\s*)(<.*>)\s*(?:\(\d+\))?$/) { }
0 0 elsif ($op =~ /^ at .+ line \d+$/) { }
625 35 6 if ($main->{'bases_split_out_alternations'}) { }
639 159 271 if (length $buf > length $longestexact)
647 9 626 if $item eq 'NOTHING'
652 142 484 if (not $spcs and $item =~ /^EXACT/ and $args =~ /<(.*)>/) { }
190 294 elsif (not $spcs and $item =~ /^_moretrie/ and $args =~ /<(.*)>/) { }
0 294 elsif ($item =~ /^EXACT/ and $prevop and not $prevop->[0] and $prevop->[1] =~ /^CURLYX/ and $prevop->[2] =~ /\{(\d+),/ and $1 >= 1 and $args =~ /<(.*)>/) { }
5 289 elsif ($item =~ /^_moretrie/ and $prevop and not $prevop->[0] and $prevop->[1] =~ /^CURLYX/ and $prevop->[2] =~ /\{(\d+),/ and $1 >= 1 and $args =~ /<(.*)>/) { }
656 1 141 if ($buf =~ s/\\x\{[0-9a-fA-F]{4,}\}.*$//)
660 0 142 if (length $str >= 55 and $buf =~ s/\.\.\.$//)
669 4 186 if (length $1 >= 55 and $buf =~ s/\.\.\.$//)
681 0 0 if (length $1 >= 55 and $buf =~ s/\.\.\.$//)
693 0 5 if (length $1 >= 60 and $buf =~ s/\.\.\.$//)
701 173 116 unless ($item =~ /^(?:END|CLOSE\d|MINMOD)$/)
711 1 135 if (not $longestexact) { }
716 130 5 $main->{'bases_must_be_casei'} ? :
730 0 187 if $depth++ > 5
792 0 187 if (scalar @ops > 1 and $ops[0][1] =~ /^BRANCH/)
807 130 838 unless defined $op
812 54 784 if ($item =~ /^OPEN/) { }
49 735 elsif ($item =~ /^TRIE/) { }
8 727 elsif ($item =~ /^BRANCH/) { }
7 720 elsif ($item =~ /^EXACT/ and defined $open_spcs) { }
2 718 elsif (defined $open_spcs) { }
840 130 57 if (scalar @ops == 0)
855 8 49 $branch_spcs ? :
859 0 387 unless defined $op
863 9 378 if (defined $branch_spcs and $branch_spcs eq $spcs and $item =~ /^BRANCH/) { }
0 378 elsif (defined $branch_spcs and $branch_spcs eq $spcs and $item eq 'TAIL') { }
135 243 elsif (defined $trie_spcs and $trie_spcs eq $spcs and $item eq '_moretrie') { }
52 191 elsif (defined $open_spcs and $open_spcs eq $spcs and $item =~ /^CLOSE/) { }
5 186 elsif ($item eq 'END') { }
878 86 49 if (scalar @in_this_branch > 0)
883 0 135 $branch_spcs ? :
906 186 0 if ($open_sub_spcs)
917 0 57 if (defined $branch_spcs)
976 0 0 if (scalar @want != scalar @got) { }
983 0 0 unless ($got{$w})
990 0 0 if ($failed) { }
991 0 0 unless print 'want: /' . join('/ /', @want) . "/\n"
992 0 0 unless print 'got: /' . join('/ /', @got) . "/\n"
995 0 0 unless print "ok\n"
1011 0 41 if ($fromconf) { }
41 0 elsif ($^X =~ m[^/]) { }
1029 0 0 if (open IN, '<' . $cachefile)
1032 0 0 unless defined $nread
1033 0 0 unless close IN
1037 0 0 if (eval $str)
1053 0 0 if (mkdir $cachedir) { }
0 0 elsif ($! == 17) { }
1061 0 0 unless open CACHE, ">$cachefile"
1062 0 0 unless print CACHE $dump->Dump, ';1;'
1063 0 0 unless close CACHE
1080 0 0 unless print "INPUT: /$re/\n"
0 135 if ($fixup_re_test)
1091 0 0 if (length $pre)
1095 0 0 if ($tok eq '"') { }
0 0 elsif ($tok eq '\\') { }
1099 0 0 unless $re =~ /\G(x\{[^\}]+\}|[0-7]{1,3}|.)/cgs
1101 0 0 if ($esc eq '"') { }
0 0 elsif ($esc eq '\\') { }
0 0 elsif ($esc =~ /^x\{(\S+)\}\z/) { }
0 0 elsif ($esc =~ /^[0-7]{1,3}\z/) { }
1114 0 0 unless print "PRE: $pre\nTOK: $tok\n"
1118 135 0 if (not defined pos $re) { }
0 0 elsif (pos $re <= length $re) { }
1134 0 0 unless print "OUTPUT: $output\n"
0 135 if ($fixup_re_test)