Branch Coverage

lib/Wiki/JSON/Parser.pm
Criterion Covered Total %
branch 331 384 86.2


line true false branch
26 0 123 if ($self->used)
40 52 167 if ($self->_parse_options->{'track_lines_for_errors'})
44 156 96 if ("HASH" ne ref $element)
48 78 18 if (defined $element->{'output'})
60 2045 80 unless (defined $new_i)
68 0 234 if scalar @_ != 3
71 2 232 if ($buffer =~ /^$/su)
82 0 0 if ($current_char eq "|")
91 0 2045 if ($options->{'is_unordered_list'})
102 55 1990 if ($last_word eq $searched)
109 4 1986 if ($last_word eq $searched)
118 3 77 if ($options->{'is_unordered_list'})
122 67 10 unless ($options->{'is_nowiki'})
124 47 6 unless ($options->{'is_bold'} or $options->{'is_italic'})
141 1 2 if (length $buffer)
142 0 1 if ($options->{'br_found'} or $options->{'element_found'}) { }
160 138 30 if ("HASH" ne ref $element)
169 12 3 if (defined $self->_current_list_output)
183 14 1 if (length $buffer)
205 80 2045 if (defined $new_i)
215 1924 121 unless ($options->{'is_unordered_list'})
232 5 116 if ($last_word eq $searched)
234 5 0 if (length $buffer)
235 1 4 if (defined $self->_current_list_output) { }
254 15 106 if ($last_word eq $searched)
268 80 2045 if ($needs_interruption)
283 80 2045 if ($needs_return)
296 1882 104 unless ($options->{'is_nowiki'})
298 1432 450 unless ($options->{'is_header'})
302 60 1372 if $needs_next
307 14 1808 if $needs_next
311 3 1805 if $needs_next
312 1688 117 unless ($options->{'is_unordered_list'})
316 7 1681 if $needs_next
321 11 1787 if $needs_next
325 8 1779 if $needs_next
329 17 1762 if $needs_next
333 12 1750 if $needs_next
352 59 2066 if ($needs_next)
355 80 1986 if ($needs_return)
361 132 1854 if ($needs_next)
366 74 72 if (not $options->{'is_nowiki'} and length $buffer)
368 4 70 if ($options->{'is_unordered_list'})
369 1 3 if ($options->{'element_found'} or $options->{'br_found'})
384 6 140 if ($options->{'is_bold'} or $options->{'is_italic'})
395 2754 12 if ($tag ne $next_word)
416 104 10 if ($tag ne $next_word)
430 1808 0 unless ($is_bold_and_italic_single_step)
431 1805 3 if ($last_word ne $searched)
435 0 3 if ($last_word ne $searched)
439 0 3 if ($is_bold_and_italic_single_step)
443 0 3 if ($is_bold_and_italic_single_step)
456 5 3625 if ($last_word eq $searched)
466 1434 254 if (0 < length $buffer)
472 247 7 if ($last_word ne $searched)
485 106 18 if ($self->_try_discard_interrupt_list($wiki_text, $i))
503 3 15 if ($last_word ne $searched)
515 106 18 if ($last_word ne $searched)
523 8 116 if ($options->{'is_unordered_list'})
524 5 3 if (length $buffer or not @$output)
531 86 38 unless (length $buffer)
546 1817 5 unless ($is_bold_and_italic_single_step)
547 1808 9 if ($last_word ne $searched)
552 5 9 if ($is_bold_and_italic_single_step)
556 5 9 if ($is_bold_and_italic_single_step)
568 15 21 if ($options->{'is_italic'})
571 16 20 if ($options->{'is_bold'})
575 7 29 if ($is_bold_and_italic)
594 12 24 unless (defined $element->{'type'})
605 111 119 if ($is_bold_and_italic)
609 1 110 if ($last_word eq $searched)
618 12 217 if ($last_word eq $searched)
620 5 7 if ($options->{'is_italic'})
628 8 209 if ($last_word eq $searched)
630 2 6 if ($options->{'is_bold'})
643 5 19 if ($i + 1 >= length $wiki_text)
658 17 161 unless ($last_word =~ /^\[\[File:$valid_characters+$/ux)
673 1762 17 if ($last_word ne $searched)
681 0 17 if ($size_search < $orig_size_search + 1)
685 1 16 if ($last_word =~ /^\[\[File:($valid_characters+)\]\]$/ux)
701 0 16 unless ($got_link)
717 16 891 if ($last_component)
723 58 833 if ($searched eq $last_word)
734 0 833 if ($need_next)
760 16 891 if ($searched eq $last_word)
773 16 0 if ($last_word =~ /^\[\[File:($valid_characters+)\|/ux)
782 4 34 if (defined $element_options->{'format'}{$option})
791 1 73 if ($tmp_buffer =~ /^border$/ux)
795 1 72 if ($tmp_buffer =~ /^frameless$/ux)
796 1 0 if $self->_is_defined_image_format_exclusive($element_options)
801 5 67 if ($tmp_buffer =~ /^frame$/ux)
802 1 4 if $self->_is_defined_image_format_exclusive($element_options)
807 1 66 if ($tmp_buffer =~ /^framed$/ux)
808 0 1 if $self->_is_defined_image_format_exclusive($element_options)
813 2 64 if ($tmp_buffer =~ /^thumb$/ux)
814 1 1 if $self->_is_defined_image_format_exclusive($element_options)
819 1 63 if ($tmp_buffer =~ /^thumbnail$/ux)
820 1 0 if $self->_is_defined_image_format_exclusive($element_options)
830 1 51 if ($tmp_buffer =~ /^left$/ux)
831 0 1 if $self->_is_defined_image_halign_exclusive($element_options)
836 1 50 if ($tmp_buffer =~ /^right$/ux)
837 1 0 if $self->_is_defined_image_halign_exclusive($element_options)
842 1 49 if ($tmp_buffer =~ /^center$/ux)
843 1 0 if $self->_is_defined_image_halign_exclusive($element_options)
848 1 48 if ($tmp_buffer =~ /^none$/ux)
849 1 0 if $self->_is_defined_image_halign_exclusive($element_options)
859 1 47 if ($tmp_buffer =~ /^baseline$/ux)
860 0 1 if $self->_is_defined_image_valign_exclusive($element_options)
865 1 46 if ($tmp_buffer =~ /^sub$/ux)
866 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
871 1 45 if ($tmp_buffer =~ /^super$/ux)
872 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
877 1 44 if ($tmp_buffer =~ /^top$/ux)
878 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
883 1 43 if ($tmp_buffer =~ /^text-top$/ux)
884 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
889 1 42 if ($tmp_buffer =~ /^middle$/ux)
890 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
895 1 41 if ($tmp_buffer =~ /^bottom$/ux)
896 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
901 1 40 if ($tmp_buffer =~ /^text-bottom$/ux)
902 1 0 if $self->_is_defined_image_valign_exclusive($element_options)
912 2 37 if (my($thumbtime) = $tmp_buffer =~ /^thumbtime=((?:\d+:)?(?:\d+:)\d+)$/ux)
915 1 1 if defined $element_options->{'thumbtime'}
919 2 35 if (my($start) = $tmp_buffer =~ /^start=((?:\d+:)?(?:\d+:)\d+)$/ux)
920 1 1 if defined $element_options->{'start'}
924 1 34 if ($tmp_buffer =~ /^muted$/ux)
925 0 1 if defined $element_options->{'muted'}
929 1 33 if ($tmp_buffer =~ /^loop$/ux)
930 0 1 if defined $element_options->{'loop'}
939 1 47 if (my($link) = $tmp_buffer =~ /^link=(.*)$/ux)
940 0 1 if defined $element_options->{'link'}
944 4 43 if (my($alt) = $tmp_buffer =~ /^alt=(.*)$/ux)
945 0 4 if defined $element_options->{'alt'}
949 2 41 if (my($page) = $tmp_buffer =~ /^page=(\d+)$/ux)
950 0 2 if defined $element_options->{'page'}
954 1 40 if (my($loosy) = $tmp_buffer =~ /^loosy=(.*)$/ux)
955 0 1 if $loosy ne "false"
956 0 1 if defined $element_options->{'not_loosy'}
960 1 39 if (my($class_string) = $tmp_buffer =~ /^class=(.*)$/ux)
961 0 1 if defined $element_options->{'classes'}
971 6 33 if defined $return_video
980 11 63 if (defined $found_something)
986 11 52 if $return_now
990 4 48 if defined $return_caption_halign
994 0 48 if defined $return_caption_halign
998 15 33 if defined $return_component_extra
1000 16 17 unless (defined $caption)
1008 7 1 if (defined $element_options->{'valign'})
1016 3 1 if (defined $element_options->{'halign'})
1025 5 18 if (defined $element_options->{'resize'}{$option})
1034 2 61 if (my($width) = $tmp_buffer =~ /^(\d+)(?:\ |)px$/ux)
1035 1 1 if $self->_is_defined_image_resizing_exclusive($element_options)
1040 4 57 if (my($height) = $tmp_buffer =~ /^x(\d+)(?:\ |)px$/ux)
1041 2 2 if $self->_is_defined_image_resizing_exclusive($element_options)
1046 0 57 if (my($width, $height) = $tmp_buffer =~ /^(\d+)x(\d+)(?:\ |)px$/ux)
1047 0 0 if $self->_is_defined_image_resizing_exclusive($element_options)
1053 5 52 if (my($upright) = $tmp_buffer =~ /^upright(?:\ |=)(\d+\.\d+)$/ux)
1054 2 3 if $self->_is_defined_image_resizing_exclusive($element_options)
1067 12 151 unless ($last_word =~ /^\[\[$valid_characters+$/ux)
1077 5 0 if ($last_word =~ /^\[\[($valid_characters+)\|/ux)
1088 1750 12 if ($last_word ne $searched)
1095 0 12 if ($size_search < $MINIMUM_LINK_SEARCH)
1099 7 5 if ($last_word =~ /^\[\[($valid_characters+)\]\]$/ux)
1113 0 5 unless ($got_url)
1121 5 66 if $self->_try_parse_link_find_end_title($wiki_text, $i)
1126 1 65 if $need_next
1147 5 66 if ($searched eq $last_word)
1158 15 44 unless ($last_word =~ /^\{\{[a-zA-Z]+$/ux)
1172 1783 15 if ($last_word ne $searched)
1178 4 11 if ($size_search < $MINIMUM_TEMPLATE_SEARCH)
1182 4 7 if ($last_word =~ /^\{\{([a-zA-Z]+)}}$/ux)
1197 0 7 unless ($got_template_name)
1216 13 85 if ($searched eq $last_word)
1226 5 80 if ($searched eq $last_word)
1236 3 77 if $needs_next
1239 2 5 if (length $current_buffer or $needs_arg)
1250 0 0 if ($last_word ne "}}")
1259 7 0 if ($last_word =~ /^\{\{([a-zA-Z]+)\|/ux)
1268 1372 60 if ($last_char ne "=")
1278 60 136 if ($last_chars ne "=" x ($matching + 1))
1282 0 136 if ($matching > $MAX_HX_SIZE)
1286 0 136 if ($i + $matching > length $wiki_text)
1305 12 484 if ($char eq "\n")
1308 450 34 if ($char ne "=")
1312 4 84 if ("\n" eq substr($wiki_text, $i, 1))
1316 4 80 if ("=" ne substr($wiki_text, $i, 1))
1324 60 0 if (scalar @{$header->{'output'};})
1325 60 0 unless (ref $header->{'output'}[0])
1327 1 59 unless ($header->{'output'}[0])
1333 59 1 if (defined $last_element and not ref $last_element)
1336 1 58 unless ($header->{'output'}[$last_index])