Branch Coverage

blib/lib/Parse/BBCode.pm
Criterion Covered Total %
branch 198 212 93.4


line true false branch
31 32 6 if ($args{'tags'}) { }
37 3 35 if ($args{'escapes'}) { }
67 42 0 if not $seen{$_}++
79 9 29 if (exists $defs->{''}) { }
81 8 1 if (ref $plain eq 'CODE')
89 6 23 if ($url_finder)
91 0 6 unless ($result)
99 5 24 if ($text_processor)
102 1 28 if ($smileys and ref $smileys->{'icons'} eq 'HASH') { }
129 6 23 if ($url_finder) { }
131 1 5 if (ref $url_finder eq 'CODE') { }
135 1 4 unless (ref $url_finder eq 'HASH')
146 1 1 if ($max_url and length $title > $max_url)
161 3 6 if ($info->{'classes'}{'url'}) { }
167 8 1 if $linebreaks
175 234 2 if $linebreaks
186 187 88 if (not ref $def) { }
8 80 elsif (not exists $def->{'code'} and exists $def->{'output'}) { }
195 235 40 unless defined $defs->{$key}{'classic'}
196 35 240 unless defined $defs->{$key}{'close'}
210 8 187 if (ref $def eq 'HASH') { }
214 1 7 if exists $new_def->{'close'}
215 6 2 if exists $new_def->{'class'}
221 43 152 if ($output =~ s/^(inline|block|url)://)
228 307 473 if ($p =~ /$re_cmp/) { }
232 163 144 if (grep {$_ eq 'parse';} @escapes)
248 329 528 if (ref $c) { }
257 4 325 if ($type eq 'attr' and @$attributes > 1) { }
13 312 elsif ($type eq 'a') { }
61 251 elsif ($type eq 'A') { }
1 250 elsif ($type eq 'id') { }
249 1 elsif ($type eq 's') { }
260 4 0 if ($item->[0] eq $name)
276 240 9 if (ref $string eq 'SCALAR')
284 95 231 if ($sub)
286 8 87 unless (defined $var)
311 3 561 unless defined(my $code = $self->get_plain)
317 3 197 $self->get_attribute_parser ? :
335 128 223 if (@opened) { }
340 14 209 if (@tags and not ref $tags[-1]) { }
356 147 206 if (@opened) { }
199 7 elsif (ref $tag) { }
360 6 141 if (ref $tag and $class =~ /inline|url/ and $tag->get_class eq 'block') { }
121 20 elsif (ref $tag) { }
364 2 4 if ($self->get_close_open_tags) { }
381 112 9 if ($parse) { }
388 1 7 if (ref $c) { }
406 163 36 if ($parse) { }
413 2 33 if (ref $c) { }
439 29 523 if ($re_classic and $re_short) { }
0 523 elsif (not $re_classic and $re_short) { }
523 0 elsif ($re_classic and not $re_short) { }
463 340 212 if (length $before)
478 220 43 if ($try->get_name eq lc $name) { }
33 10 elsif (not $try->get_close) { }
489 1 9 if ($self->get_close_open_tags) { }
493 1 0 if (@opened)
504 28 192 if (@not_close)
512 220 0 if ($f)
513 192 28 unless (@not_close)
527 10 542 if (defined $tag1)
531 8 2 if ($after =~ s( :// ([^\[]+) \] )[]x) { }
546 4 4 defined $title && length $title ? :
550 1 7 if ($in_url and $tag->get_class eq 'url') { }
568 374 168 if ($after) { }
1 167 elsif ($tag) { }
575 368 6 if ($ok) { }
577 0 368 unless defined $attr
600 34 135 if ($last and not $last->get_close and not $close)
607 3 365 if ($open->get_single and not $nested_url) { }
364 1 elsif (not $nested_url) { }
616 320 44 if ($parse) { }
624 39 5 if ($after =~ s( (.*?) (\[ / $tag \]) )[]six) { }
657 8 192 if ($self->get_close_open_tags) { }
670 200 0 if ($scalar_util) { }
706 3 8 if ($type and $errors->{$type}) { }
6 2 elsif (keys %$errors) { }
717 1 199 if (@_ < 2)
724 20 179 if ($self->get_error)
748 542 564 if (ref $tree) { }
768 535 7 if (($tree->get_type || 'classic') eq 'classic') { }
769 101 434 defined $attr && length $attr ? :
773 3 4 @$content ? :
775 434 108 if (ref $fallback)
782 322 220 if ($self->get_strip_linebreaks and ($tree->get_class || '') eq 'block')
783 89 233 if (@$content == 1 and not ref $content->[0] and defined $content->[0]) { }
193 40 elsif (@$content > 1) { }
788 60 133 if (not ref $content->[0] and defined $content->[0])
791 167 26 if (not ref $content->[-1] and defined $content->[-1])
796 502 40 if (not exists $defs->{$name}{'parse'} or $parse) { }
804 343 199 if ($code) { }
822 4 532 unless defined $str
838 366 4 if ($self->get_direct_attribute and $$text =~ s/^(=[^\]]*)?]// or $$text =~ s/^( [^\]]*)?\]//)
845 261 105 unless defined $attr
847 261 105 unless (length $attr)
850 104 1 if ($self->get_direct_attribute)
853 1 104 if ($self->get_strict_attributes and not length $attr)
857 103 1 if (length $attribute_quote == 1) { }
858 103 0 if ($attr =~ s/^(?:$attribute_quote(.+?)$attribute_quote(?:\s+|$)|(.*?)(?:\s+|$))//)
859 25 78 defined $1 ? :
864 7 2 defined $2 ? :
869 1 0 if ($attr =~ s/^(?:(["'])(.+?)\1|(.*?)(?:\s+|$))//)
870 0 1 defined $2 ? :
875 1 0 defined $3 ? :
879 1 100 if ($self->get_strict_attributes and length $attr and $attr =~ tr/ /\000-\037!-\377/c)
893 343 0 unless ($tag->get_finished)