Branch Coverage

blib/lib/Text/Xslate/Parser.pm
Criterion Covered Total %
branch 217 248 87.5


line true false branch
221 3429 3 if (my $input_pos = pos $parser->{'input'})
222 2 3427 if ($input_pos != length $parser->{'input'})
246 391 9985 if ($i >= 1 and ($p = $$tokens_ref[$i - 1])->[0] eq 'postchomp')
252 386 5 if ($1)
258 51 10325 if ($i + 1 < @{$tokens_ref;} and ($p = $$tokens_ref[$i + 1])->[0] eq 'prechomp') { }
16 10309 elsif ($i + 2 < @{$tokens_ref;} and ($p = $$tokens_ref[$i + 2])->[0] eq 'prechomp' and ($p = $$tokens_ref[$i + 1])->[0] eq 'text' and not $p->[1] =~ / [^ \t] /msx) { }
260 34 17 if (not ${$s_ref;} =~ / [^ \t] /msx) { }
315 2671 15617 if ($in_tag) { }
2561 13056 elsif ($lex_line_code and @tokens == 0 || $tokens[-1][1] =~ /\n\z/msx and s/$lex_line_code//msx) { }
2672 10384 elsif (s/$lex_tag_start//msx) { }
10384 0 elsif (s/$lex_text//msx) { }
321 2667 3 if (length $code == 0)
327 2667 4 if ($pos >= 0) { }
332 0 2667 unless s/\A \Q$tag_end\E //msx
335 393 2274 if ($chomp)
354 60 2612 if ($chomp)
366 5 3474 if ($in_tag)
394 10376 5680 if ($type eq 'text') { }
5227 453 elsif ($type eq 'code') { }
60 393 elsif ($type eq 'prechomp') { }
393 0 elsif ($type eq 'postchomp') { }
403 8835 1541 if $nl > 0
407 5227 0 if $shortcut
412 548 4679 if ($s =~ /\A \s* [}] \s* \z/msx) { }
2032 2647 elsif ($s =~ s/\n\z//msx) { }
630 25265 27718 if (defined $s) { }
631 1205 24060 if (defined $lbp)
664 46 64703 if (/\G $comment_rx /cgmsx) { }
19483 45220 elsif (/\G ($id_rx)/cgmsx) { }
17593 27627 elsif (/\G ($Text::Xslate::Parser::NUMBER | $Text::Xslate::Parser::STRING)/cgmosx) { }
24190 3437 elsif (/\G ($OPERATOR_TOKEN)/cgmosx) { }
0 3437 elsif (/\G (\S+)/cgmsx) { }
695 7 64667 if (defined $expect and $t->id ne $expect)
705 3438 61229 if ($t->[0] eq 'special')
714 63 61166 if ($arity eq 'name' and $parser->next_token_is('=>'))
721 17655 43574 if ($arity eq 'literal') { }
24161 19413 elsif ($arity eq 'operator') { }
729 3 24158 unless (defined $symbol)
813 17270 249 if ($parser->token->is_value)
817 12209 5310 unless ($parser->token->is_comma)
902 409 38 if ($arity eq 'name') { }
9 29 elsif ($arity eq 'literal') { }
915 0 447 unless ($parser->is_valid_field($t))
926 230 217 if ($t->id eq '(')
950 4 190 unless (ref $function)
1017 482 241 defined $value ? :
1040 2879 772 if ($name =~ /\A \$/msx) { }
1057 6013 16658 if (defined $s)
1062 9344 4115 defined $s ? :
1067 13243 571 if ($symbol->arity ne 'name' or $symbol->is_reserved)
1073 0 571 if ($t)
1074 0 0 if ($t->is_reserved)
1077 0 0 if ($t->arity eq 'name')
1092 1 597 if (defined $t)
1093 0 1 $t->is_reserved ? :
1119 109 899 unless (ref $symbol)
1123 0 1008 unless (ref $lhs)
1129 39 969 unless (ref $rhs)
1157 30 14053 if ($t->can_be_modifier)
1163 1445 12638 if ($t->is_block_end or $parser->statement_is_finished) { }
12634 4 elsif ($t->id eq ';') { }
1179 448 14901 if ($t->id eq ';')
1184 13652 1249 if ($t->has_std)
1198 82 1141 if ($expr->is_statement) { }
1254 51 4 if ($parser->token->id eq '.')
1258 0 51 unless (any_in($t->arity, ('variable', 'name')))
1263 0 51 unless ($generator)
1270 15 36 if ($parser->token->id eq '(')
1286 34 0 $symbol->id eq 'my' ? :
37 34 $symbol->id eq 'constant' ? :
1290 0 71 if ($t->arity ne $expect)
1329 39 0 if ($parser->token->id ne '{')
1332 0 39 if $paren
1340 15 39 if ($t->id eq ',') { }
1348 0 39 if $paren
1366 1 0 ref $file ? :
1402 418 20 if ($parser->token->id eq '->')
1404 226 192 if ($parser->token->id ne '{')
1407 106 120 if $paren
1414 150 82 if ($in_for)
1420 7 225 if ($t->id eq ',') { }
1428 106 120 if $paren
1468 5 135 if ($parser->token eq 'else')
1495 0 150 if ($name->arity ne 'name')
1514 0 93 if ($name->arity ne 'name')
1524 0 11 if ($t->arity ne 'name')
1531 2 9 if ($t->id eq '(')
1537 2 9 $args ? :
1546 9 84 if (@filters)
1568 13 100 if (defined $expr)
1590 56 43 if ($t->id eq 'else')
1594 11 45 $t->id eq 'if' ? :
1610 14 16 unless (defined $given->second and @{$given->second;})
1624 0 60 unless ($parser->in_given)
1628 31 29 if ($symbol->id eq 'when')
1650 22 79 if ($when->arity ne $expect)
1652 21 1 if ($when->id eq 'print_raw' and not grep({not _only_white_spaces($_);} @{$when->first;}))
1660 43 36 if (defined(my $test = $when->first)) { }
1661 31 12 unless ($test->is_logical)
1671 35 8 if (not defined $if) { }
1680 36 3 if (defined $else)
1681 33 3 if (defined $elsif) { }
1688 38 1 defined $if ? :
1708 11511 0 if ($parser->token->id ne ';')
1723 1265 69 if ($t->arity ne 'name' or $t->is_defined)
1736 52 69 if ($t->id eq '::') { }
1739 0 52 if ($t->arity ne 'name')
1756 13 1287 if ($parser->token->id eq '{')
1771 58 7 if ($parser->token->id ne 'with')
1776 11 54 if ($parser->token->id eq 'with')
1824 1 15 if @args != 0
1831 1 9 if @args != 0
1838 1 6 if @args != 0
1845 1 3 if @args != 0
1852 0 16 if @args != 0
1861 1 2 if @args != 0
1868 1 7 if @args != 0
1887 0 3 if @args != 0
1893 2 3 if @args != 0
1905 0 6 if @args < 2
1955 0 3260 if (exists $parser->symbol_table->{$to})
1974 12 1 if (defined $got and $got ne ';') { }
1975 2 10 if ($got eq '(end)') { }
1991 39 10 if ($near ne ';' and not $message =~ /\b \Q$near\E \b/msx)