Branch Coverage

blib/lib/Text/Haml.pm
Criterion Covered Total %
branch 329 384 85.6


line true false branch
22 22 0 if (defined $dir and -d $dir and -w _)
128 1 25 ref $_ ? :
129 24 2 ref $self->path eq 'ARRAY' ? :
139 0 19 @_ > 1 ? :
140 7 38 @_ > 1 ? :
141 0 14 @_ > 1 ? :
142 7 546 @_ > 1 ? :
143 125 129 @_ > 1 ? :
144 125 125 @_ > 1 ? :
145 0 138 @_ > 1 ? :
146 0 5 @_ > 1 ? :
147 0 11 @_ > 1 ? :
148 0 125 @_ > 1 ? :
149 0 125 @_ > 1 ? :
150 0 125 @_ > 1 ? :
151 144 1674 @_ > 1 ? :
152 26 59 @_ > 1 ? :
153 0 18 @_ > 1 ? :
154 8 35 @_ > 1 ? :
155 0 6 @_ > 1 ? :
156 6 13 @_ > 1 ? :
157 24 258 @_ > 1 ? :
158 3 4 @_ > 1 ? :
161 0 4 if (@_ > 1) { }
192 1 143 unless defined $tmpl
248 129 15 if $tmpl =~ /\n$/
249 1 143 if $tmpl eq "\n"
253 298 377 if ($line =~ s/^($level_token+)//) { }
262 6 669 if (defined $multiline_code_el and $line =~ /^[-!=%#.:]/)
268 10 665 if ($line =~ /^$comment_token(?: (.*))?/)
270 4 6 if $1
277 34 631 if ($prev and $prev->{'type'} eq 'filter')
278 22 12 if ($prev->{'level'} < $el->{'level'} or $i + 1 < @lines and $line eq '')
281 10 12 if $prev->{'text'}
290 12 631 if ($line =~ /^:(\w+)/)
299 16 615 if ($line =~ /^!!!(?: ([^ ]+)(?: (.*))?)?$/)
308 8 607 if ($line =~ m(^/(?:\[if (.*)?\])?(?: *(.*))?))
310 2 6 if $1
311 6 2 if $2
317 2 605 if ($line =~ s/^\\//)
324 48 551 if ($line =~ s/^- \s*(.*)(\s\|\s*)$// or $line =~ s/^- \s*(.*)// or defined $multiline_code_el and $line =~ s/^(.*)(\s\|\s*)$//)
330 18 36 if ($2)
345 1 550 if ($line =~ s/^~ \s*(.*)//)
355 243 307 if ($line =~ /^(?:$tag_start |$class_start |$id_start )/x)
364 221 22 if ($line =~ s/^$tag_start$tag_name//)
369 31 256 if ($line =~ s/^$class_start$tag_name//) { }
13 243 elsif ($line =~ s/^$id_start$tag_name//) { }
387 40 203 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)
406 30 10 if ($line =~ s/^$attributes_start//) { }
414 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//) { }
429 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) { }
455 3 58 if ($name =~ s/^(?:'|")//)
460 47 14 if ($value =~ s/^(?:'|")//) { }
7 7 elsif ($value eq 'true' or $value eq 'false') { }
467 5 2 $value eq 'true' ? :
480 40 0 if @$attrs
483 1 242 if ($line =~ s/^$trim_out ?//)
487 1 242 if ($line =~ s/^$trim_in ?//)
492 55 495 if ($line =~ s/^($escape_token|$unescape_token)?$expr_token //)
494 8 47 if ($1)
495 3 5 quotemeta $1 eq $escape_token ? :
499 15 228 if ($el->{'type'} eq 'tag' and $line =~ s/$autoclose_token$// || grep({$el->{'name'} eq $_;} @AUTOCLOSE))
507 247 303 if $line
510 20 530 if ($line and $line =~ s/(\s*)$multiline_token$//) { }
513 6 14 if (not $tape->[-1] or ref $tape->[-1]{'text'} ne 'ARRAY') { }
532 226 304 if $line
555 411 364 if (scalar @$lines and $lines->[-1] eq '}') { }
564 95 680 if (scalar @$lines and $lines->[-1] eq '{') { }
593 24 101 unless ($self->namespace)
616 0 11 unless $name =~ /^\w+$/
622 4 7 defined $prototype ? :
626 2 9 $options->{'arg_force_self'} ? :
636 1 19 unless $var =~ /^\w+$/
637 2 17 if ($self->vars_as_subs) { }
638 0 2 if $self->helpers->{$var}
660 37 531 if $in_block
663 233 335 if $level > 0
666 522 46 if (not exists $el->{'escape'} and $self->escape_html or exists $el->{'escape'} and $el->{'escape'} == 1)
677 25 543 if ($prev_stack_el and $prev_stack_el->{'type'} eq 'comment')
678 8 17 if ($el->{'line'} and $prev_stack_el->{'level'} >= $el->{'level'}) { }
690 67 363 if ($el->{'line'} and $prev_stack_el and $prev_stack_el->{'level'} >= $el->{'level'})
697 18 67 if $in_block
698 50 35 $level > 0 ? :
701 49 36 if ($poped->{'type'} eq 'tag') { }
0 36 elsif ($poped->{'type'} eq 'html_comment') { }
705 0 0 if $poped->{'if'}
709 49 36 if ($poped->{'type'} ne 'block')
715 36 49 if ($poped->{'type'} eq 'block')
719 67 18 if $poped->{'level'} == $el->{'level'}
726 219 332 if ($el->{'type'} eq 'tag')
728 10 209 $el->{'autoclose'} && $self->format eq 'xhtml' ? :
731 27 192 if ($el->{'attrs'})
738 6 32 if ($name eq 'class') { }
3 29 elsif ($name eq 'id') { }
740 4 2 if ($value->{'type'} eq 'text') { }
750 1 2 if $el->{'id'}
755 26 3 if ($value->{'type'} eq 'text' or $value->{'type'} eq 'expr') { }
2 1 elsif ($value->{'type'} eq 'boolean' and $value->{'text'}) { }
762 25 1 if ($value->{'type'} eq 'text') { }
774 1 1 if ($self->format eq 'xhtml')
783 28 191 if ($el->{'class'})
791 14 205 if ($el->{'id'})
797 17 202 if ($el->{'text'} and $el->{'expr'}) { }
60 142 elsif ($el->{'text'}) { }
28 114 elsif (not $next_el or $next_el and $next_el->{'level'} <= $el->{'level'}) { }
114 0 elsif (not $el->{'autoclose'}) { }
798 13 4 if ($escape eq 'escape') { }
810 60 0 unless $el->{'autoclose'}
818 15 13 unless $el->{'autoclose'}
830 145 187 if ($el->{'line'} and $el->{'type'} eq 'text')
833 0 145 unless defined $el->{'text'}
835 31 114 if ($el->{'expr'}) { }
114 0 elsif ($el->{'text'}) { }
851 41 146 if ($el->{'type'} eq 'block')
857 9 32 if ($prev_el and $prev_el->{'level'} > $el->{'level'})
861 14 27 if ($next_el and $next_el->{'level'} > $el->{'level'})
867 6 140 if ($el->{'type'} eq 'html_comment')
871 1 5 if $el->{'if'}
873 4 2 if ($el->{'text'}) { }
887 9 131 if ($el->{'type'} eq 'comment')
893 10 121 if ($el->{'type'} eq 'filter')
895 0 10 unless $filter
897 1 9 if ($el->{'name'} eq 'escaped') { }
913 121 0 unless ($el->{'text'})
928 380 188 if $output
936 113 12 if $self->tape->[-1] and $self->tape->[-1]{'line'} eq ''
942 65 8 if ($el->{'type'} eq 'tag') { }
2 6 elsif ($el->{'type'} eq 'html_comment') { }
946 1 1 if $el->{'if'}
950 67 6 if $ending
953 5 68 if ($el->{'type'} eq 'block')
959 12 113 if ($lines[-1] and not $last_empty_line)
961 12 0 if ($lines[-2] and $lines[-1] eq '}') { }
984 0 216 if ($text =~ /^\"/ and $text =~ /\"$/)
1002 25 218 if ($text =~ s/^(.*?)?(?
2 216 elsif ($text =~ s/^(.*?)?\\\\(\#\{$curly_brace_n\})//msx) { }
1014 20 223 if ($t)
1016 0 20 $expr ? :
1019 27 216 if ($found) { }
1022 2 25 $escape ? :
1032 0 216 $expr ? :
1046 0 212 if ($text =~ /\G $start_tag (.*?) $end_tag/cgmsx) { }
0 212 elsif ($text =~ /\G (.*?) (?=$start_tag)/cgmsx) { }
1059 4 212 unless @parts
1068 0 125 unless $code
1070 0 48 unless defined $s
1072 2 123 if ($@)
1089 1 124 if ($@)
1105 0 125 unless defined $self->build(@_)
1108 2 123 unless $self->compile
1119 1 0 unless ref $self->fullpath eq 'SCALAR'
1121 0 0 if $self->cache == 2
1122 0 0 if $self->cache == 0
1128 0 0 unless $file->open($self->cache_path, 'r')
1141 1 0 if $self->encoding
1153 6 2 if ($self->cache >= 1)
1160 2 1 if (-e $self->cache_path and $self->_eq_mtime || $self->_eq_checksum)
1167 1 5 if (ref $self->fullpath eq 'SCALAR') { }
1172 0 5 unless $file->open($self->fullpath, 'r')
1184 6 0 if $self->encoding
1188 6 0 if ($output = $self->render($content, @_))
1189 4 2 if ($self->cache >= 1)
1191 4 0 if ($file->open($self->cache_path, 'w'))
1194 1 3 if (ref $self->fullpath eq 'SCALAR') { }
1214 1 7 if ('File::Spec'->file_name_is_absolute($path) and -r $path)
1220 1 6 if (ref $p eq 'HASH') { }
1221 1 0 if (defined(my $content = $p->{$path}))
1227 6 0 if (-r $fullpath)
1240 1 5 ref $self->fullpath eq 'SCALAR' ? :
1251 3 3 unless (-e $cache_dir)
1254 0 3 if $@
1275 0 3 if ref $self->fullpath eq 'SCALAR'
1277 2 1 if $self->cache == 2
1278 0 1 if $self->cache == 0
1281 0 1 unless $file->open($self->cache_path, 'r')
1306 2 14 if ($type eq 'xml')
1307 0 2 if $self->format eq 'html5'
1308 0 2 if $self->format eq 'html4'
1313 10 4 if ($self->format eq 'xhtml') { }
3 1 elsif ($self->format eq 'html4') { }
1 0 elsif ($self->format eq 'html5') { }
1314 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') { }
1343 1 2 if ($type eq 'strict') { }
1 1 elsif ($type eq 'frameset') { }