Branch Coverage

lib/Mail/SpamAssassin/Plugin/BodyRuleBaseExtractor.pm
Criterion Covered Total %
branch 160 276 57.9


line true false branch
97 0 15 unless ($main->{'base_extract'})
100 0 15 if $self->{'show_progress'}
126 0 15 if $self->{'show_progress'}
138 0 15 if $self->{'show_progress'}
145 0 15 if ($self->{'main'}{'bases_cache_dir'})
153 0 42 if $self->{'show_progress'} and $progress
159 0 42 if (defined $cent)
160 0 0 if (defined $cent->{'g'}) { }
183 42 0 unless ($is_a_replacetags_rule)
189 2 40 unless (eval { do { my($qr, $mods) = $self->simplify_and_qr_regexp($rule); ($lossy, @bases) = $self->extract_hints($rule, $qr, $mods); 1 } })
190 2 0 $@ ne '' ? :
194 0 42 if ($lossy and ($tflags->{$name} || '') =~ /\bmultiple\b/)
204 3 132 if ($len < $min_chars) { }
62 70 elsif (not defined $minlen or $len < $minlen) { }
209 5 37 if ($is_a_replacetags_rule or not $minlen or not @bases) { }
210 5 0 !@bases ? :
0 5 $is_a_replacetags_rule ? :
225 4 2520 if ($base1 ne $base2 and $base1 =~ /\Q$base2\E/)
233 4 128 if $subsumed{$base}
248 0 15 if $self->{'show_progress'} and $progress
290 0 15 if $self->{'show_progress'}
302 0 128 unless $base and $set1->{'name'}
315 0 128 if $self->{'show_progress'} and $progress
317 24 104 unless $base1
324 104 3143 if $set1 == $set2
326 483 2660 unless $base2
331 24 34 if ($base1 eq $base2 and $name1 eq $name2 and $orig1 eq $set2->[2])
340 1126 1510 if $len1 < $set2->[3]
345 87 1423 if $set2->[5] and $name2 =~ /(?: |^)\Q$name1\E(?: |$)/
349 54 1369 if $set1->[5] and $set1->[1] =~ /(?: |^)\Q$name2\E(?: |$)/
352 1342 27 unless $base1 =~ /$set2->[4]/
367 24 104 unless $base
369 12 92 if (defined $bases{$base}) { }
381 17 120 if exists $u{$i}
385 0 15 if $self->{'show_progress'} and $progress
387 0 15 if ($cachefile)
393 0 15 if $self->{'show_progress'}
431 37 5 if ($main->{'bases_must_be_casei'}) { }
435 19 18 if $mods =~ s/i//
438 1 36 if $rule =~ s/(?<!\\)\(\?i\:(.*?)\)/$1/gs
441 0 37 if $rule =~ s/(?<!\\)\(\?-i\:(.*?)\)/$1/gs
447 0 5 if $rule =~ /\(\?i\)/
448 1 4 if $mods =~ /i/
451 0 4 if $rule =~ s/(?<!\\)\(\?i\:(.*?)\)/$1/gs
458 0 41 if $mods =~ s/m//
459 2 39 if $mods =~ s/s//
463 0 41 if $rule =~ s/\(\^\|\\b\)//gs
464 0 41 if $rule =~ s/\(\$\|\\b\)//gs
465 0 41 if $rule =~ s/\(\\b\|\^\)//gs
466 0 41 if $rule =~ s/\(\\b\|\$\)//gs
469 1 40 if $rule =~ s/\(\?\![^\)]+\)//gs
472 5 36 if $rule =~ s/(?<!\\)\\b//gs
478 26 15 if $lossy
492 26 15 if $mods =~ s/L//
496 0 41 if $rule =~ /^\(?(?:\^|\\A)/
501 0 41 if $rule =~ s/(?<!\\)(?:\$|\\Z)\)?$//
505 41 0 unless $main->{'bases_allow_noncapture_groups'}
514 0 41 unless $tmpfh
517 0 41 unless print $tmpfh 'use bytes; m{' . $rule . '}' . $mods
519 0 41 unless close $tmpfh
523 0 41 unless open IN, "$perl -c -Mre=debug $tmpf 2>&1 |"
528 0 41 unless defined $nread
530 0 41 unless unlink $tmpf
531 0 41 unless close IN
532 0 41 unless defined $fullstr
546 0 41 unless ($fullstr =~ /((?:\s[^\n]+\n)+)/m)
565 0 439 unless $op
567 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+$/) { }
601 35 6 if ($main->{'bases_split_out_alternations'}) { }
615 159 271 if (length $buf > length $longestexact)
623 9 626 if $item eq 'NOTHING'
628 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 =~ /<(.*)>/) { }
632 1 141 if ($buf =~ s/\\x\{[0-9a-fA-F]{4,}\}.*$//)
636 0 142 if (length $str >= 55 and $buf =~ s/\.\.\.$//)
645 4 186 if (length $1 >= 55 and $buf =~ s/\.\.\.$//)
657 0 0 if (length $1 >= 55 and $buf =~ s/\.\.\.$//)
669 0 5 if (length $1 >= 60 and $buf =~ s/\.\.\.$//)
677 173 116 unless ($item =~ /^(?:END|CLOSE\d|MINMOD)$/)
687 1 135 if (not $longestexact) { }
692 130 5 $main->{'bases_must_be_casei'} ? :
706 0 187 if $depth++ > 5
768 0 187 if (scalar @ops > 1 and $ops[0][1] =~ /^BRANCH/)
783 130 838 unless defined $op
788 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) { }
816 130 57 if (scalar @ops == 0)
831 8 49 $branch_spcs ? :
835 0 387 unless defined $op
839 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') { }
854 86 49 if (scalar @in_this_branch > 0)
859 0 135 $branch_spcs ? :
882 186 0 if ($open_sub_spcs)
893 0 57 if (defined $branch_spcs)
952 0 0 if (scalar @want != scalar @got) { }
959 0 0 unless ($got{$w})
966 0 0 if ($failed) { }
967 0 0 unless print 'want: /' . join('/ /', @want) . "/\n"
968 0 0 unless print 'got: /' . join('/ /', @got) . "/\n"
971 0 0 unless print "ok\n"
987 0 41 if ($fromconf) { }
41 0 elsif ($^X =~ m[^/]) { }
1005 0 0 if (open IN, '<' . $cachefile)
1008 0 0 unless defined $nread
1009 0 0 unless close IN
1013 0 0 if (eval $str)
1027 0 0 if (mkdir $self->{'main'}{'bases_cache_dir'}) { }
0 0 elsif ($! == 17) { }
1034 0 0 unless open CACHE, ">$cachefile"
1035 0 0 unless print CACHE $dump->Dump, ';1;'
1036 0 0 unless close CACHE
1053 0 0 unless print "INPUT: /$re/\n"
0 135 if ($fixup_re_test)
1064 0 0 if (length $pre)
1068 0 0 if ($tok eq '"') { }
0 0 elsif ($tok eq '\\') { }
1072 0 0 unless $re =~ /\G(x\{[^\}]+\}|[0-7]{1,3}|.)/cgs
1074 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/) { }
1087 0 0 unless print "PRE: $pre\nTOK: $tok\n"
1091 135 0 if (not defined pos $re) { }
0 0 elsif (pos $re <= length $re) { }
1107 0 0 unless print "OUTPUT: $output\n"
0 135 if ($fixup_re_test)