Branch Coverage

blib/lib/BBCode/Util.pm
Criterion Covered Total %
branch 165 292 56.5


line true false branch
22 49 322 unless exists $EXPORT_TAGS{$tag}
29 2135 0 if ($_[0] =~ /^((?:\w+::)*\w+)$/)
46 0 0 unless defined $file
49 0 0 unless UNIVERSAL::isa($obj, 'BBCode::Tag')
56 0 2133 unless $_[0] =~ m[^/?(_?\w+)$]
58 305 1828 if (exists $userTags{$tag}) { }
72 154 0 if eval { do { tagLoadPackage $tag; 1 } }
82 199 3283 if (ref $_) { }
83 199 0 if UNIVERSAL::isa($_, 'BBCode::Tag')
86 1982 1301 if /^(:\w+)$/
95 0 0 if (ref $tag) { }
96 0 0 if UNIVERSAL::isa($tag, 'BBCode::Tag')
107 0 469 if $tag =~ /^:/
136 10 49 if /[\\\[\]"'=,\s\n]/
142 0 102 unless length $a <=> length $b
153 122 0 if (defined $_)
173 0 17 unless defined $_
174 0 17 if ref $_ and UNIVERSAL::can($_, 'as_bool')
175 13 4 if /^(?: 1 | T | TR | TRU | TRUE | Y | YE | YES | ON )$/xi
181 4 0 if /^(?: 0 | F | FA | FAL | FALS | FALSE | N | NO | OFF )$/xi
187 0 0 $_ ? :
193 0 53 unless defined $num
196 6 47 if $num =~ /^-?$/
197 46 1 if $num =~ /^ ( -? \d+ ) $/x
205 0 48 unless defined $num
207 4 44 if ($num =~ /^ (.*) e (.*) $/xi)
211 4 0 if defined $m and defined $e
214 13 31 if ($num =~ /^ ([^.]*) \. ([^.]*) $/x)
217 0 13 unless defined $i
218 0 13 unless $f =~ /^(\d*)$/
230 0 15 unless defined $_
237 3 12 if (/^ 0x ([0-9A-F]+) $/xi) { }
1 11 elsif (/^ 0o ([0-7]+) $/xi) { }
1 10 elsif (/^ 0b ([01]+) $/xi) { }
0 10 elsif (/^ 0 ([0-7]{3}) $/x) { }
1 9 elsif (/^ (\d+) $/x) { }
249 6 9 if defined $ch
252 1 8 if $decoded eq "&$_;"
275 1 8 if (defined $_)
276 0 1 if (/^(disc|circle|square|none)$/i) { }
0 1 elsif (/^( decimal(?:-leading-zero)? | (?:upper|lower)-(?:roman|latin|alpha) | lower-greek | hebrew | georgian | armenian | cjk-ideographic | (?:hiragana|katakana)(?:-iroha)? )$/xi) { }
1 0 elsif (exists $listtype{$_}) { }
322 0 45 unless defined $_
324 41 4 unless defined $base
325 41 4 unless defined $lo
326 41 4 unless defined $hi
331 3 42 if (/^( (?:xx?-)? (?:large|small) | medium )$/xi)
339 2 40 if (/^ ( larger | smaller ) $/xi)
344 17 23 if (/^ ( [\s\d._+-]+ ) ( [a-z]+ ) $/xi)
347 17 0 if (defined $n and $n > 0) { }
349 15 2 if (exists $conv{$unit}) { }
1 1 elsif ($unit =~ /^em$/i) { }
1 0 elsif ($unit =~ /^ex$/i) { }
359 2 15 if (defined $lo and $n2 < $lo) { }
3 12 elsif (defined $hi and $n2 > $hi) { }
375 9 14 if (/^ ( [\s\d._+-]+ ) % $/x)
377 9 0 if (defined $n and $n > 0) { }
380 1 8 if (defined $lo and $n2 < $lo) { }
1 7 elsif (defined $hi and $n2 > $hi) { }
397 8 6 if (/^ (\d+) $/x)
399 8 0 if ($n >= 0 and $n < @compat) { }
407 2 4 if (/^ \+ (\d+) $/x)
414 2 2 if (/^ - (\d+) $/x)
440 0 8 unless defined $_
444 5 3 if /^(\w+)$/ and exists $cssColor{$1}
445 0 3 if exists $extraColor{$_}
447 1 2 if (s/^#//) { }
451 0 1 if /^ [0-9a-f]{3} $/x
452 1 0 if /^ [0-9a-f]{6} $/x
454 0 2 if /^( rgb \( (?: \d+ , ){2} \d+ \) )$/x
455 0 2 if /^( rgba\( (?: \d+ , ){3} \d+ \) )$/x
456 0 2 if /^( rgb \( (?: \d+% , ){2} \d+% \) )$/x
457 1 1 if /^( rgba\( (?: \d+% , ){3} \d+% \) )$/x
466 0 35 if s/(#.*)$//
467 30 5 if s/^([\w+-]+)://
470 35 0 if wantarray
478 1 24 if s/(\?.*)$//
481 25 0 if wantarray
489 19 0 if (s[^//][]) { }
0 0 elsif (m[^/]) { }
490 19 0 if s[^([^/]+)][]
496 0 0 if wantarray
500 19 0 if wantarray
508 0 19 if (/^ ([^\@]*) \@ ([^\@]*) $/x) { }
517 0 19 if (defined $_)
518 0 0 if (/^ ([^:]*) : ([^:]*) $/x) { }
526 0 19 if (s/:(\d+)$//) { }
0 19 elsif (s/:([\w+-]+)$//) { }
530 0 0 unless defined $ret[3]
536 15 4 if (/^ ( (?: [\w-]+ \. )+ ) $/x)
541 4 15 unless defined $ret[2]
542 15 0 if wantarray
545 4 0 if wantarray
567 5 30 unless defined $scheme
568 0 30 unless exists $urltype{$scheme}
570 25 5 if ($urltype{$scheme} > 0)
573 19 6 if ($urltype{$scheme} > 1)
575 0 19 unless defined $path
577 19 0 if ($urltype{$scheme} > 2)
578 0 19 unless defined $auth
580 4 15 unless defined $host
583 0 15 if (defined $user)
585 0 0 if defined $pass
589 0 15 if defined $port
592 45 0 defined $_ ? :
595 22 20 defined $_ ? :
597 0 26 defined $fragment ? :
600 0 26 unless defined $url->scheme
601 4 22 unless exists $$schemes{$url->scheme}
602 0 22 if $url->as_string =~ /\bsanity\.check\.example\.com\b/i
603 0 22 if $url->can('userinfo') and defined $url->userinfo
604 0 22 if $url->can('host') and not defined $url->host
605 6 16 if ($url->scheme eq 'mailto')
609 6 0 if ($key =~ /^(?:to|cc|bcc)$/i)
613 2 4 if (/^ ( [\w.+-]+ \@ (?: \w[\w-]*(?<=\w) \. )+ [a-z]{2,6} ) $/xi)
614 0 2 if (exists $safe{$key}) { }
623 0 0 if ($key =~ /^subject$/i)
624 0 0 if ($unsafe{$key} =~ /^ ( [\x20-\x7E]+ ) $/x)
630 4 2 unless exists $safe{'to'}
643 16 16 if defined $url
655 2 1 if defined $url
662 518 0 if (defined wantarray)
664 514 4 unless wantarray
672 0 0 unless ref $url
673 0 0 unless defined $url
674 0 0 if ($url->scheme eq 'mailto')
677 0 0 if ($url->scheme eq 'http' or $url->scheme eq 'https')
678 0 0 if (not defined $url->query or $url->query eq '')
679 0 0 if ($url->path eq '' or $url->path eq '/')
685 0 0 if ($url->scheme eq 'ftp')
688 0 0 if ($url->scheme eq 'data')
690 0 0 if (defined $m)
703 0 0 unless ref $url
704 0 0 unless defined $url
705 0 0 if ($url->scheme eq 'data')
715 0 0 if ($n > 0)
718 0 0 if ($n < 0)
728 0 0 if defined $val and !defined($max) || $val > $max
737 0 0 unless defined $start
739 0 0 if (@list and $list[0] eq 'ol')
740 0 0 @list > 1 ? :
780 0 0 if ($type =~ /^decimal-leading-zero$/i)
781 0 0 if (defined $total) { }
791 0 0 if (defined $total) { }
804 7 0 if exists $EXPORT_TAGS{'ALL'}
805 0 7 if exists $EXPORT_TAGS{'DEFAULT'}