Branch Coverage

blib/lib/WWW/Shopify/Liquid/Parser.pm
Criterion Covered Total %
branch 131 158 82.9


line true false branch
37 2 15 if defined $_[1]
38 0 0 if defined $_[1]
39 4 7 if defined $_[1]
53 856 945 if $tag->is_free
54 945 856 if ($tag->is_enclosing)
67 1530 850 if ($element) { }
83 1 2 if ($tag->is_enclosing) { }
84 1 0 if $self->enclosing_tags->{$tag->name}
86 0 0 if $self->inner_tags->{$inner_tag}
89 2 0 if $self->free_tags->{$tag->name}
95 1 0 if $self->filters->{$filter->name}
102 0 144 $filter->isa('WWW::Shopify::Liquid::Token::Operator') ? :
105 15 129 if ($filter_name =~ /::/) { }
108 0 15 if ($@)
109 0 0 unless $self->accept_unknown_filters
113 15 114 if (not $self->{'filters'}{$filter_name}) { }
114 1 14 unless $self->accept_unknown_filters
120 0 143 if int @tokens > 0 and $tokens[0]{'core'} ne ':'
124 91 52 if (shift @tokens)
126 43 134 if $_->isa('WWW::Shopify::Liquid::Token::Separator') and $_->{'core'} eq ','
141 27 1 unless $_->isa('WWW::Shopify::Liquid::Token::Hash')
151 618 964 if $argument_tokens[$_]->isa('WWW::Shopify::Liquid::Token::Variable')
163 8 2716 if $_->isa('WWW::Shopify::Liquid::Token::Variable::Named')
171 2713 11 unless $_->isa('WWW::Shopify::Liquid::Token::Hash')
174 651 0 if $_->isa('WWW::Shopify::Liquid::Token::Operator') and defined $_->{'core'} and $self->operator($_->{'core'})
177 0 3 $fixness eq 'postfix' ? :
178 0 3 $fixness eq 'potsfix' ? :
188 647 2074 if $_->isa('WWW::Shopify::Liquid::Token::Operator')
1100 120 if (int grep({$_->{'core'} eq '|' if $_->isa('WWW::Shopify::Liquid::Token::Operator');} @argument_tokens) == 0) { }
191 6 1967 if $_->isa('WWW::Shopify::Liquid::Token::Separator')
211 1150 10341 if ($operators->[0] eq 'WWW::Shopify::Liquid::Operator::Pipe') { }
212 456 1489 if $_->isa('WWW::Shopify::Liquid::Token::Operator')
120 1030 if ((my $idx = &firstidx(sub { $_->{'core'} eq '|' if $_->isa('WWW::Shopify::Liquid::Token::Operator'); } , @tokens)) != -1)
213 0 120 if $idx == 0
216 144 120 if $_->[0]{'core'} and $_->[0]{'core'} eq '|'
144 532 if $_->isa('WWW::Shopify::Liquid::Token::Operator') and $_->{'core'} eq '|'
225 2893 14062 if $_->isa('WWW::Shopify::Liquid::Token::Operator')
228 1 418 unless $idx > 0 and $idx < $#tokens and $op1->isa('WWW::Shopify::Liquid::Operator') || $op1->isa('WWW::Shopify::Liquid::Token::Operand') || $op1->isa('WWW::Shopify::Liquid::Filter') and $op2->isa('WWW::Shopify::Liquid::Operator') || $op2->isa('WWW::Shopify::Liquid::Token::Operand') || $op2->isa('WWW::Shopify::Liquid::Filter')
232 0 501 if $op1->isa('WWW::Shopify::Liquid::Token::Grouping')
233 0 501 if $op2->isa('WWW::Shopify::Liquid::Token::Grouping')
240 1 1147 unless int grep({not $_->isa('WWW::Shopify::Liquid::Token::Variable::Named');} @tokens) == 1 or int grep({not $_->isa('WWW::Shopify::Liquid::Token::Variable::Named');} @tokens) == 0
251 33 801 if int @tokens == 0
257 493 911 if ($token->isa('WWW::Shopify::Liquid::Token::Tag')) { }
327 584 elsif ($token->isa('WWW::Shopify::Liquid::Token::Output')) { }
259 318 175 if ($self->enclosing_tags->{$token->tag}) { }
169 6 elsif ($self->free_tags->{$token->tag}) { }
266 922 725 if ($tokens[$_]->isa('WWW::Shopify::Liquid::Token::Tag'))
267 175 747 if ($self->enclosing_tags->{$tokens[$_]->tag}) { }
82 665 elsif (exists $allowed_internal_tags{$tokens[$_]->tag} and $level == 1) { }
313 352 elsif ($tokens[$_]->tag eq 'end' . $token->tag and $level == 1) { }
175 177 elsif ($tokens[$_]->tag =~ /^end/) { }
277 2 21 if $self->enclosing_tags->{$token->tag}->inner_ignore_whitespace and int @contents > 0 and int @{$contents[0];} > 0 and $contents[0][0]->isa('WWW::Shopify::Liquid::Token::Text::Whitespace')
280 112 395 if (int @array > 0 and $array[0]->isa('WWW::Shopify::Liquid::Token::Tag') and $allowed_internal_tags{$array[0]->tag}) { }
299 5 311 unless $closed
308 0 0 if $token->tag =~ /^end(\w+)$/ and $self->enclosing_tags->{$1}
309 1 5 if exists $self->inner_tags->{$token->tag}
323 216 567 if (int @tags > 1) { }
336 3 1 if ($_->isa('WWW::Shopify::Liquid::Tag')) { }
1 0 elsif ($_->isa('WWW::Shopify::Liquid::Filter')) { }
348 1 434 if $self->is_processed($ast)
349 30 404 if ($ast->isa('WWW::Shopify::Liquid::Filter')) { }
99 305 elsif ($ast->isa('WWW::Shopify::Liquid::Operator')) { }
353 1 29 $ast->transparent ? :
27 3 int @{$ast->{'arguments'};} > 0 ? :
357 37 27 $_ > 0 ? :
364 1 98 if $ast->requires_grouping
373 59 159 if $self->is_processed($ast) or $ast->isa('WWW::Shopify::Liquid::Token')
374 119 40 if ($ast->isa('WWW::Shopify::Liquid::Tag'))
375 119 0 $ast->{'arguments'} ? :
376 51 68 if ($ast->isa('WWW::Shopify::Liquid::Tag::Enclosing')) { }
23 45 elsif ($ast->isa('WWW::Shopify::Liquid::Tag::Output')) { }
377 29 22 if ($ast->isa('WWW::Shopify::Liquid::Tag::If')) { }
378 26 3 unless $ast->{'false_path'}
379 1 2 if ($ast->{'false_path'}->isa('WWW::Shopify::Liquid::Tag::If'))
385 1 0 $ast->{'arguments'} ? :
386 0 1 if ($ast->{'false_path'} and $ast->{'false_path'}->isa('WWW::Shopify::Liquid::Tag::If')) { }
1 0 elsif ($ast->{'false_path'}) { }
409 0 40 if ($ast->isa('WWW::Shopify::Liquid::Filter'))
412 40 0 if $ast->isa('WWW::Shopify::Liquid::Operator::Concatenate')