Branch Coverage

blib/lib/Text/Haml.pm
Criterion Covered Total %
branch 305 360 84.7


line true false branch
22 22 0 if (defined $dir and -d $dir and -w _)
126 1 25 ref $_ ? :
128 24 2 ref $self->path eq 'ARRAY' ? :
138 0 19 @_ > 1 ? :
139 7 37 @_ > 1 ? :
140 0 14 @_ > 1 ? :
141 7 516 @_ > 1 ? :
142 118 122 @_ > 1 ? :
143 118 118 @_ > 1 ? :
144 0 123 @_ > 1 ? :
145 0 11 @_ > 1 ? :
146 0 118 @_ > 1 ? :
147 0 118 @_ > 1 ? :
148 0 118 @_ > 1 ? :
149 137 1586 @_ > 1 ? :
150 26 59 @_ > 1 ? :
151 0 18 @_ > 1 ? :
152 8 35 @_ > 1 ? :
153 0 6 @_ > 1 ? :
154 6 13 @_ > 1 ? :
155 0 118 @_ > 1 ? :
156 3 4 @_ > 1 ? :
159 0 2 if (@_ > 1) { }
189 1 136 unless defined $tmpl
244 122 15 if $tmpl =~ /\n$/
245 1 136 if $tmpl eq "\n"
249 271 362 if ($line =~ s/^($level_token+)//) { }
259 10 623 if ($line =~ /^$comment_token(?: (.*))?/)
261 4 6 if $1
268 34 589 if ($prev and $$prev{'type'} eq 'filter')
269 22 12 if ($$prev{'level'} < $$el{'level'} or $i + 1 < @lines and $line eq '')
272 10 12 if $$prev{'text'}
281 12 589 if ($line =~ /^:(\w+)/)
290 16 573 if ($line =~ /^!!!(?: ([^ ]+)(?: (.*))?)?$/)
299 8 565 if ($line =~ m(^/(?:\[if (.*)?\])?(?: *(.*))?))
301 2 6 if $1
302 6 2 if $2
308 2 563 if ($line =~ s/^\\//)
315 36 527 if ($line =~ s/^- \s*(.*)//)
323 1 526 if ($line =~ s/^~ \s*(.*)//)
333 232 294 if ($line =~ /^(?:$tag_start |$class_start |$id_start |${attributes_start}[^$attributes_start] |$attributes_start2 )/x)
344 210 22 if ($line =~ s/^$tag_start$tag_name//)
349 31 245 if ($line =~ s/^$class_start$tag_name//) { }
13 232 elsif ($line =~ s/^$id_start$tag_name//) { }
367 40 192 if ($line =~ /^ (?: $attributes_start\s* $attribute_prefix? $attribute_name\s* $attribute_arrow\s* $attribute_value | $attributes_start2\s* $attribute_name2\s* $attribute_arrow2\s* $attribute_value2 ) /x)
386 30 10 if ($line =~ s/^$attributes_start//) { }
394 3 101 if (not $line) { }
30 71 elsif ($type eq 'perl' and $line =~ s/^$attributes_end//) { }
10 61 elsif ($type eq 'html' and $line =~ s/^$attributes_end2//) { }
409 44 17 if ($line =~ s/^\s*$attribute_prefix? ($attribute_name)\s* $attribute_arrow\s* ($attribute_value)\s* (?:$attributes_sep\s*)?//x) { }
17 0 elsif ($line =~ s/^\s* ($attribute_name2)\s* $attribute_arrow2\s* ($attribute_value2)\s* (?:$attributes_sep2\s*)?//x) { }
435 3 58 if ($name =~ s/^(?:'|")//)
440 47 14 if ($value =~ s/^(?:'|")//) { }
7 7 elsif ($value eq 'true' or $value eq 'false') { }
447 5 2 $value eq 'true' ? :
460 40 0 if @$attrs
463 1 231 if ($line =~ s/^$trim_out ?//)
467 1 231 if ($line =~ s/^$trim_in ?//)
472 55 471 if ($line =~ s/^($escape_token|$unescape_token)?$expr_token //)
474 8 47 if ($1)
475 3 5 quotemeta $1 eq $escape_token ? :
479 14 218 if ($$el{'type'} eq 'tag' and $line =~ s/$autoclose_token$// || grep({$$el{'name'} eq $_;} @AUTOCLOSE))
487 237 289 if $line
490 20 506 if ($line and $line =~ s/(\s*)$multiline_token$//) { }
493 6 14 if (not $$tape[-1] or ref $$tape[-1]{'text'} ne 'ARRAY') { }
512 216 290 if $line
564 0 2 unless $name =~ /^\w+$/
573 1 19 unless $var =~ /^\w+$/
574 2 17 if ($self->vars_as_subs) { }
575 0 2 if $self->helpers->{$var}
597 21 517 if $in_block
603 492 46 if (not exists $$el{'escape'} and $self->escape_html or exists $$el{'escape'} and $$el{'escape'} == 1)
614 25 513 if ($prev_stack_el and $$prev_stack_el{'type'} eq 'comment')
615 8 17 if ($$el{'line'} and $$prev_stack_el{'level'} >= $$el{'level'}) { }
626 64 343 if ($$el{'line'} and $prev_stack_el and $$prev_stack_el{'level'} >= $$el{'level'})
633 13 67 if $in_block
637 46 34 if ($$poped{'type'} eq 'tag') { }
0 34 elsif ($$poped{'type'} eq 'html_comment') { }
641 0 0 if $$poped{'if'}
645 46 34 if ($$poped{'type'} ne 'block')
649 64 16 if $$poped{'level'} == $$el{'level'}
656 208 313 if ($$el{'type'} eq 'tag')
657 9 199 $$el{'autoclose'} && $self->format eq 'xhtml' ? :
661 27 181 if ($$el{'attrs'})
668 6 32 if ($name eq 'class') { }
3 29 elsif ($name eq 'id') { }
670 4 2 if ($$value{'type'} eq 'text') { }
680 1 2 if $$el{'id'}
685 26 3 if ($$value{'type'} eq 'text' or $$value{'type'} eq 'expr') { }
2 1 elsif ($$value{'type'} eq 'boolean' and $$value{'text'}) { }
692 25 1 if ($$value{'type'} eq 'text') { }
704 1 1 if ($self->format eq 'xhtml')
713 28 180 if ($$el{'class'})
721 14 194 if ($$el{'id'})
727 17 191 if ($$el{'text'} and $$el{'expr'}) { }
56 135 elsif ($$el{'text'}) { }
26 109 elsif (not $next_el or $next_el and $$next_el{'level'} <= $$el{'level'}) { }
109 0 elsif (not $$el{'autoclose'}) { }
728 13 4 if ($escape eq 'escape') { }
739 56 0 unless $$el{'autoclose'}
748 14 12 unless $$el{'autoclose'}
759 139 174 if ($$el{'line'} and $$el{'type'} eq 'text')
762 0 139 unless defined $$el{'text'}
764 31 108 if ($$el{'expr'}) { }
108 0 elsif ($$el{'text'}) { }
780 35 139 if ($$el{'type'} eq 'block')
784 7 28 if ($prev_el and $$prev_el{'level'} > $$el{'level'})
788 7 28 if ($next_el and $$next_el{'level'} > $$el{'level'})
794 6 133 if ($$el{'type'} eq 'html_comment')
798 1 5 if $$el{'if'}
800 4 2 if ($$el{'text'}) { }
813 9 124 if ($$el{'type'} eq 'comment')
818 10 114 if ($$el{'type'} eq 'filter')
820 0 10 unless $filter
822 1 9 if ($$el{'name'} eq 'escaped') { }
838 114 0 unless ($$el{'text'})
847 363 175 if $output
853 106 12 if $self->tape->[-1] and $self->tape->[-1]{'line'} eq ''
860 63 4 if ($$el{'type'} eq 'tag') { }
2 2 elsif ($$el{'type'} eq 'html_comment') { }
864 1 1 if $$el{'if'}
868 65 2 if $ending
871 118 0 if ($lines[-1])
872 12 106 unless $last_empty_line
891 0 206 if ($text =~ /^\"/ and $text =~ /\"$/)
909 21 208 if ($text =~ s/^(.*?)?(?
2 206 elsif ($text =~ s/^(.*?)?\\\\(\#\{$curly_brace_n\})//msx) { }
921 16 213 if ($t)
923 0 16 $expr ? :
926 23 206 if ($found) { }
929 2 21 $escape ? :
939 0 206 $expr ? :
953 0 202 if ($text =~ /\G $start_tag (.*?) $end_tag/cgmsx) { }
0 202 elsif ($text =~ /\G (.*?) (?=$start_tag)/cgmsx) { }
966 4 202 unless @parts
975 0 118 unless $code
977 0 41 unless defined $s
979 2 116 if ($@)
996 1 117 if ($@)
1012 0 118 unless defined $self->build(@_)
1015 2 116 unless $self->compile
1026 1 0 unless ref $self->fullpath eq 'SCALAR'
1028 0 0 if $self->cache == 2
1029 0 0 if $self->cache == 0
1035 0 0 unless $file->open($self->cache_path, 'r')
1048 1 0 if $self->encoding
1060 6 2 if ($self->cache >= 1)
1067 2 1 if (-e $self->cache_path and $self->_eq_mtime || $self->_eq_checksum)
1074 1 5 if (ref $self->fullpath eq 'SCALAR') { }
1079 0 5 unless $file->open($self->fullpath, 'r')
1091 6 0 if $self->encoding
1095 6 0 if ($output = $self->render($content, @_))
1096 4 2 if ($self->cache >= 1)
1098 4 0 if ($file->open($self->cache_path, 'w'))
1101 1 3 if (ref $self->fullpath eq 'SCALAR') { }
1121 1 7 if ('File::Spec'->file_name_is_absolute($path) and -r $path)
1127 1 6 if (ref $p eq 'HASH') { }
1128 1 0 if (defined(my $content = $$p{$path}))
1134 6 0 if (-r $fullpath)
1147 1 5 ref $self->fullpath eq 'SCALAR' ? :
1158 3 3 unless (-e $cache_dir)
1161 0 3 if $@
1182 0 3 if ref $self->fullpath eq 'SCALAR'
1184 2 1 if $self->cache == 2
1185 0 1 if $self->cache == 0
1188 0 1 unless $file->open($self->cache_path, 'r')
1213 2 14 if ($type eq 'xml')
1214 0 2 if $self->format eq 'html5'
1215 0 2 if $self->format eq 'html4'
1220 10 4 if ($self->format eq 'xhtml') { }
3 1 elsif ($self->format eq 'html4') { }
1 0 elsif ($self->format eq 'html5') { }
1221 1 9 if ($type eq 'strict') { }
1 8 elsif ($type eq 'frameset') { }
1 7 elsif ($type eq '5') { }
1 6 elsif ($type eq '1.1') { }
1 5 elsif ($type eq 'basic') { }
1 4 elsif ($type eq 'mobile') { }
1250 1 2 if ($type eq 'strict') { }
1 1 elsif ($type eq 'frameset') { }