Branch Coverage

blib/lib/Text/MediawikiFormat.pm
Criterion Covered Total %
branch 106 194 54.6


line true false branch
156 1 14 if @_ == 1
169 19 71 if (defined(my $val = delete $_[0]{$key}))
216 0 2890 if (not defined $obj) { }
231 2659 elsif (ref $obj eq 'HASH') { }
913 1746 elsif (ref $obj eq 'ARRAY') { }
226 1746 1144 if $type eq 'SCALAR'
227 913 231 if $type eq 'ARRAY'
241 0 169 unless UNIVERSAL::isa($left, 'HASH') and UNIVERSAL::isa($right, 'HASH')
247 235 8 if (exists $$right{$leftkey}) { }
259 2031 235 unless exists $$left{$rightkey}
270 0 371 unless defined $left
271 0 371 unless defined $right
277 169 202 if (ref $left eq 'HASH') { }
51 151 elsif (ref $left eq 'ARRAY') { }
285 169 202 if (ref $right eq 'HASH') { }
49 153 elsif (ref $right eq 'ARRAY') { }
298 0 1 if $Text::MediawikiFormat::missing_html_packages
305 3 15 unless @_ > 1
315 1 14 if $$iopts{'process_html'}
418 11 12 if ($_[2] eq ';') { }
420 6 5 if ($_[0] =~ /^(.*?)\s+:\s+(.*)$/) { }
436 11 12 if defined $term
437 18 5 if defined $def
462 0 28 unless $$opts{'charset'}
463 28 0 if $$opts{'charset'} =~ /^utf-?8$/i
474 7 25 if ($tag =~ /^\[\[([^|#]*)(?:(#)([^|]*))?(?:(\|)(.*))?\]\]$/) { }
5 20 elsif ($tag =~ /^\[(\S*)(?:(\s+)(.*))?\]$/) { }
477 7 0 if $1
478 0 7 if $2
480 3 4 if ($4) { }
483 3 0 if (length $5) { }
505 5 0 if ($2) { }
522 8 12 if ($tag =~ /^$s:[$Text::MediawikiFormat::uricCheat][$Text::MediawikiFormat::uric]*$/) { }
526 1 7 if $href =~ s/[$Text::MediawikiFormat::uriCruft]$//
550 3 9 if (@$toc and $level > $$toc[-1]{'level'}) { }
553 2 1 unless exists $$toc[-1]{'sublevel'}
590 0 50 if $$opts{'process_html'}
608 3 49 if keys %blocks
637 0 0 if (@$lines and not $$lines[-1][1] =~ /\n$/ and not $state ne $$lines[-1][0] && grep(/^nowiki$/, $state, $$lines[-1][0]))
643 0 0 if $state eq 'html'
648 0 0 if @$lines
651 0 0 if @$lines and $$lines[-1][1] =~ /\n$/
663 0 0 if $isEmptyTag
665 0 0 unless (grep /^\Q$tagname\E$/, @{$$tags{'allowed_tags'};})
673 0 0 @$tagstack ? :
676 0 0 if ($type eq 'E' and $stacktop eq $tagname)
683 0 0 if ($tagname eq 'nowiki') { }
698 0 0 if (@$tagstack and grep /^\Q$stacktop\E$/, ('nowiki', 'pre'))
705 0 0 if ($type eq 'E' and $HTML::Tagset::isPhraseMarkup{$tagname})
715 0 0 if ($type eq 'E')
728 0 0 if ($tagname eq 'nowiki')
730 0 0 unless $isEmptyTag
739 0 0 if (defined $$attr{$_})
742 0 0 unless ($$attr{$_} eq '__TEXT_MEDIAWIKIFORMAT_BOOL__')
751 0 0 if $HTML::Tagset::emptyElement{$tagname} or $isEmptyTag
755 0 0 if ($HTML::Tagset::isPhraseMarkup{$tagname} or $HTML::Tagset::emptyElement{$tagname})
763 0 0 if (@$tagstack)
765 0 0 if ($tagname eq $stacktop and $HTML::Tagset::optionalEndTag{$tagname}) { }
0 0 elsif (not $HTML::Tagset::is_Possible_Strict_P_Content{$tagname}) { }
776 0 0 if grep /^\Q$checking\E$/, @HTML::Tagset::p_closure_barriers
779 0 0 if ($checking eq 'p')
793 0 0 unless $isEmptyTag
796 0 0 $tagname eq 'pre' ? :
814 0 0 if $skipped_text
817 0 0 if (@$tagstack)
819 0 0 if (grep /\Q$$tagstack[-1]\E/, ('nowiki', 'pre')) { }
0 0 elsif ($is_cdata and $HTML::Tagset::isCDATA_Parent{$$tagstack[-1]}) { }
831 0 0 unless (defined $newtext)
833 0 0 unless defined $newtext
866 0 0 if $i == $#lines
877 0 0 if ($type) { }
886 0 0 if $block
898 0 50 if ($$opts{'process_html'}) { }
908 298 2 if $block
919 87 218 unless $text
920 0 218 if $type
931 443 773 if $$tags{'indented'}{$block}
936 1000 216 unless $marker_removed
952 1 53 unless @$blocks
971 117 88 unless $block->type eq 'end'
984 135 0 if ($$tags{$type}) { }
994 5 130 grep(/^\Q$type\E$/, @{$$tags{'unformatted_blocks'};}) ? :
998 18 222 if (blessed $line)
1006 32 190 if ((ref $start_line || '') eq 'CODE') { }
1018 55 80 if $between
1026 205 238 unless $text =~ s/($$tags{'indent'})//
1051 1 0 if $$opts{'extended'} or $$opts{'absolute_links'} or $$opts{'implicit_links'}
1064 4 7 if $start_pos == -1
1067 0 7 if $end_pos == -1
1087 225 2 if ($$opts{'absolute_links'})
1096 17 210 if ($$opts{'implicit_links'})
1099 17 0 if ($$tags{'implicit_link_delimiters'}) { }
1109 226 1 if ($$opts{'extended'})
1112 3 223 if (not $$tags{'extended_link_delimiters'}) { }
4 219 elsif (ref $$tags{'extended_link_delimiters'} eq 'ARRAY') { }
1125 21 0 defined $_ ? :
1137 227 0 if (@res)