Branch Coverage

blib/lib/MIME/EncWords.pm
Criterion Covered Total %
branch 170 238 71.4


line true false branch
171 42 48 if &is_utf8($str)
178 0 0 if ($cset eq 'UTF-16' or $cset eq 'UTF-16BE') { }
0 0 elsif ($cset eq 'UTF-16LE') { }
0 0 elsif ($cset eq 'UTF-32' or $cset eq 'UTF-32BE') { }
0 0 elsif ($cset eq 'UTF-32LE') { }
199 0 57 unless (length($str) % 4 == 0 and $str =~ m[^[A-Za-z0-9+/]+={0,2}$])
212 0 49 if ($str =~ /=(?![0-9a-fA-F][0-9a-fA-F])/)
235 27 468 $& eq ' ' ? :
346 39 0 $1 ? :
357 72 193 if pos $encstr >= length $encstr
361 106 87 if ($encstr =~ /\G # from where we left off.. =\?([^?]*) # "=?" + charset + \?([bq]) # "?" + encoding + \?([^?]+) # "?" + data maybe with spcs + \?= # "?=" ([\r\n\t ]*) /gix)
372 4 102 if ($charset =~ s/^([^\*]*)\*(.*)/$1/) { }
379 49 57 if ($encoding eq 'q') { }
384 0 106 unless (defined $dec)
392 24 82 if (scalar @tokens and lc($charset || '') eq lc($tokens[-1][1] || '') and &resolve_alias($charset) and !($tokens[-1][2] || $language) || lc $tokens[-1][2] eq lc $language) { }
4 78 elsif ($language) { }
78 0 elsif ($charset) { }
413 6 81 if ($encstr =~ /\G=\?/gx)
422 81 0 if ($encstr =~ /\G # from where we left off... (.*? # shortest possible string, \n*) # followed by 0 or more NLs, (?=(\Z|=\?)) # terminated by "=?" or EOS /gsx)
427 0 81 unless length $1
437 0 72 if $spc
440 72 0 if ($Params{'Detect7bit'} ne "NO")
443 87 46 unless ($t->[0] =~ /$UNSAFE/ or $t->[1])
445 0 87 if ($charset and $charset ne &MIME::Charset::default())
452 24 48 if (wantarray) { }
474 0 111 unless &MIME::Charset::USE_ENCODE
475 45 66 unless $cset->as_string
476 0 66 unless $cset->decoder or $cset->as_string eq "_UNICODE_"
481 0 66 if ($charset->as_string and $charset->as_string eq $cset->as_string)
488 0 66 if (&is_utf8($s) or $s =~ /$WIDECHAR/) { }
37 29 elsif ($charset->output_charset eq '_UNICODE_') { }
18 11 elsif ($charset->decoder) { }
489 0 0 if ($charset->output_charset ne "_UNICODE_")
493 18 19 if (not $charset->decoder) { }
494 0 18 if ($s =~ /$UNSAFE/)
501 0 0 if ($@)
546 148 0 if (ref $charset) { }
547 0 148 if (&is_utf8($word) or $word =~ /$WIDECHAR/)
555 75 73 if ($encoding eq 'Q') { }
0 73 elsif ($encoding eq 'S') { }
559 0 0 if (length $B < length $Q) { }
571 0 148 if ($language) { }
724 0 92 unless $Params{'Encoding'} =~ /^[ABQS]$/
727 92 0 if ($Params{'Folding'} =~ /^([\r\n]*)([\t ]?)$/) { }
741 5 87 $Params{'Field'} ? :
744 0 92 if (not $Params{'Minimal'}) { }
90 2 elsif (not $Params{'Minimal'} =~ /^(NO|DISPNAME)$/) { }
750 0 92 $maxrestlen <= 1 ? :
754 2 90 if $Params{'Minimal'} eq "DISPNAME"
756 68 24 unless (ref $words eq "ARRAY")
758 24 44 if ($charsetobj->as_string and $charsetobj->as_string =~ /$ASCIIINCOMPAT/)
766 1 0 $1 ? :
769 68 0 if ($Params{'Minimal'} =~ /YES|DISPNAME/) { }
772 0 658 unless scalar @words or length $w
773 295 363 if ($w =~ /[\t ]/)
780 6 357 if ($charsetobj->as_string and $charsetobj->as_string =~ /$ASCIITRANS/)
783 0 6 if (&is_utf8($w) or $w =~ /$WIDECHAR/) { }
792 295 68 if (scalar @words) { }
793 65 230 if ($w =~ /$NONPRINT|$UNSAFEASCII/ or $u ne $w xor $unsafe_last) { }
795 42 23 if ($unsafe_last) { }
812 0 68 if ($spc)
813 0 0 if (scalar @words) { }
829 0 217 unless length $s
834 66 151 if ($csetobj->as_string and $csetobj->as_string =~ /$ASCIIINCOMPAT/)
843 48 169 unless ($obj->as_string)
844 6 42 if ($Params{'Encoding'} ne "A" or $Params{'Detect7bit'} eq "NO" or $s =~ /$UNSAFE/)
858 57 54 if defined $enc and $Params{'Encoding'} eq 'S' || $Params{'Encoding'} eq 'A' && $obj->header_encoding eq 'S'
861 7 210 if ($cset eq 'US-ASCII' and not $enc and $s =~ /$UNSAFEASCII/) { }
871 5 2 $Params{'Encoding'} eq 'A' ? :
884 125 92 if (scalar @triplets)
886 26 99 if ($csetobj->decoder and ($lastcsetobj->as_string || '') eq $csetobj->as_string and ($lastenc || '') eq ($enc || '')) { }
7 92 elsif (not $lastenc and $enc and not $last =~ /[\r\n\t ]$/) { }
16 77 elsif ($lastenc and not $enc and not $s =~ /^[\r\n\t ]/) { }
892 7 0 if ($last =~ /^(.*)([\r\n\t ])([$PRINTABLE]+)$/s) { }
0 0 elsif ($lastcsetobj->as_string eq 'US-ASCII') { }
902 16 0 if ($s =~ /^([$PRINTABLE]+)([\r\n\t ])(.*)$/s) { }
0 0 elsif ($csetobj->as_string eq 'US-ASCII') { }
915 103 88 if $_->[1]
916 43 49 if (scalar @s_enc)
918 51 36 if $_->[1]
919 51 36 if $_->[1]
921 7 36 if ($Params{'Encoding'} eq 'A' and $b and not $q) { }
0 36 elsif ($Params{'Encoding'} eq 'A' and not $b and $q) { }
933 21 15 if ($total + 8 < $q * 6) { }
940 44 43 if $_->[1] and $_->[1] eq "S"
946 0 0 unless length $triplets[0][0]
952 0 92 if ($Params{'MaxLineLen'} < 0) { }
963 103 88 if ($lastenc) { }
968 78 113 if scalar @s > 1
970 4 187 if $restlen <= 1
979 0 285 unless length $str
982 137 148 if (not $encoding) { }
988 147 138 scalar @lines && $lines[-1] =~ /[\r\n\t ]$/ || $s =~ /^[\r\n\t ]/ ? :
990 92 193 if (not scalar @lines) { }
0 193 elsif ($Params{'MaxLineLen'} < 0) { }
95 98 elsif (length $lines[-1] . $spc . $s <= $restlen) { }
997 4 94 if ($lines[-1] =~ s/([\r\n\t ]+)$//)
1022 0 191 if (not $charset->as_string or $charset->as_string eq "8BIT")
1026 88 103 if (not $encoding and $charset->as_string eq "US-ASCII")
1029 0 103 if (not $charset->decoder and "Encode")
1035 102 46 if ($charset->encoded_header_len($str, $encoding) <= $restlen)
1040 46 0 if (not &is_utf8($ustr) || $ustr =~ /$WIDECHAR/ and "Encode")
1046 4 42 if ($first and not $str and $maxrestlen < $charset->encoded_header_len($first, $encoding))
1073 0 1006 unless scalar @splitwords or defined $word
1074 475 531 if ($word =~ /[\t ]/)
1081 66 465 unless $elen
1082 377 88 if (scalar @splitwords) { }
1085 328 49 if ($elen <= $restlen) { }
1098 32 56 if ($spc)
1099 32 0 if (scalar @splitwords) { }
1121 0 50 unless length $ustr
1132 129 110 if ($elen <= $restlen) { }
1153 50 0 unless $@
1156 0 0 unless ($shorter < $max)
1161 46 4 if (length $fenc) { }
1184 342 964 if (lc $i eq lc $k)
1190 0 342 unless $supported
1194 684 288 unless defined $GotParams{$i}
1198 0 164 if (not $GotParams{$i} or uc $GotParams{$i} eq 'NO') { }