Branch Coverage

blib/lib/Parse/BBCode.pm
Criterion Covered Total %
branch 196 210 93.3


line true false branch
31 6 31 if (not $args{'tags'}) { }
37 34 3 if (not $args{'escapes'}) { }
67 42 0 if not $seen{$_}++
79 9 28 if (exists $defs->{''}) { }
81 8 1 if (ref $plain eq 'CODE')
89 6 22 if ($url_finder)
91 0 6 unless ($result)
99 5 23 if ($text_processor)
102 1 27 if ($smileys and ref $smileys->{'icons'} eq 'HASH') { }
129 6 22 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 6 3 if (not $info->{'classes'}{'url'}) { }
167 8 1 if $linebreaks
175 232 2 if $linebreaks
186 186 88 if (not ref $def) { }
8 80 elsif (not exists $def->{'code'} and exists $def->{'output'}) { }
195 234 40 unless defined $defs->{$key}{'classic'}
196 35 239 unless defined $defs->{$key}{'close'}
210 8 186 if (ref $def eq 'HASH') { }
214 1 7 if exists $new_def->{'close'}
215 6 2 if exists $new_def->{'class'}
221 43 151 if ($output =~ s/^(inline|block|url)://)
228 305 470 if ($p =~ /$re_cmp/) { }
232 161 144 if (grep {$_ eq 'parse';} @escapes)
248 525 327 if (not ref $c) { }
257 4 323 if ($type eq 'attr' and @$attributes > 1) { }
13 310 elsif ($type eq 'a') { }
61 249 elsif ($type eq 'A') { }
248 1 elsif ($type eq 's') { }
260 4 0 if ($item->[0] eq $name)
273 239 9 if (ref $string eq 'SCALAR')
281 95 229 if ($sub)
283 8 87 unless (defined $var)
308 3 559 unless defined(my $code = $self->get_plain)
314 3 196 $self->get_attribute_parser ? :
331 128 222 if (@opened) { }
336 14 208 if (@tags and not ref $tags[-1]) { }
352 147 205 if (@opened) { }
198 7 elsif (ref $tag) { }
356 6 141 if (ref $tag and $class =~ /inline|url/ and $tag->get_class eq 'block') { }
121 20 elsif (ref $tag) { }
360 2 4 if ($self->get_close_open_tags) { }
377 112 9 if ($parse) { }
384 1 7 if (ref $c) { }
402 162 36 if ($parse) { }
409 2 33 if (ref $c) { }
435 29 521 if ($re_classic and $re_short) { }
0 521 elsif (not $re_classic and $re_short) { }
521 0 elsif ($re_classic and not $re_short) { }
459 339 211 if (length $before)
474 219 43 if ($try->get_name eq lc $name) { }
33 10 elsif (not $try->get_close) { }
485 1 9 if ($self->get_close_open_tags) { }
489 1 0 if (@opened)
500 28 191 if (@not_close)
508 219 0 if ($f)
509 191 28 unless (@not_close)
523 10 540 if (defined $tag1)
527 8 2 if ($after =~ s( :// ([^\[]+) \] )[]x) { }
539 4 4 defined $title && length $title ? :
542 1 7 if ($in_url and $tag->get_class eq 'url') { }
560 373 167 if ($after) { }
1 166 elsif ($tag) { }
567 367 6 if ($ok) { }
569 0 367 unless defined $attr
589 34 135 if ($last and not $last->get_close and not $close)
596 3 364 if ($open->get_single and not $nested_url) { }
363 1 elsif (not $nested_url) { }
605 319 44 if ($parse) { }
613 39 5 if ($after =~ s( (.*?) (\[ / $tag \]) )[]six) { }
646 8 191 if ($self->get_close_open_tags) { }
659 199 0 if ($scalar_util) { }
694 3 8 if ($type and $errors->{$type}) { }
6 2 elsif (keys %$errors) { }
705 1 198 if (@_ < 2)
712 20 178 if ($self->get_error)
736 540 562 if (ref $tree) { }
756 533 7 if (($tree->get_type || 'classic') eq 'classic') { }
757 101 432 defined $attr && length $attr ? :
761 3 4 @$content ? :
763 432 108 if (ref $fallback)
770 321 219 if ($self->get_strip_linebreaks and ($tree->get_class || '') eq 'block')
771 89 232 if (@$content == 1 and not ref $content->[0] and defined $content->[0]) { }
192 40 elsif (@$content > 1) { }
776 60 132 if (not ref $content->[0] and defined $content->[0])
779 166 26 if (not ref $content->[-1] and defined $content->[-1])
784 500 40 if (not exists $defs->{$name}{'parse'} or $parse) { }
792 342 198 if ($code) { }
810 4 530 unless defined $str
826 365 4 if ($self->get_direct_attribute and $$text =~ s/^(=[^\]]*)?]// or $$text =~ s/^( [^\]]*)?\]//)
833 260 105 unless defined $attr
835 260 105 unless (length $attr)
838 104 1 if ($self->get_direct_attribute)
841 1 104 if ($self->get_strict_attributes and not length $attr)
845 103 1 if (length $attribute_quote == 1) { }
846 103 0 if ($attr =~ s/^(?:$attribute_quote(.+?)$attribute_quote(?:\s+|$)|(.*?)(?:\s+|$))//)
847 25 78 defined $1 ? :
852 7 2 defined $2 ? :
857 1 0 if ($attr =~ s/^(?:(["'])(.+?)\1|(.*?)(?:\s+|$))//)
858 0 1 defined $2 ? :
863 1 0 defined $3 ? :
867 1 100 if ($self->get_strict_attributes and length $attr and $attr =~ tr/ /\000-\037!-\377/c)
881 342 0 unless ($tag->get_finished)