Branch Coverage

blib/lib/Tree/XPathEngine.pm
Criterion Covered Total %
branch 121 170 71.1


line true false branch
66 0 5 if $Tree::XPathEngine::DEBUG
91 2 1 if (grep {"$node" eq "$_";} @nodes)
101 12 1 if ($results->isa('Tree::XPathEngine::NodeSet')) { }
114 1 2 if ($results->isa('Tree::XPathEngine::NodeSet')) { }
0 2 elsif ($results->isa('Tree::XPathEngine::Node')) { }
129 102 22 $results ? :
136 1 1 scalar @nodeset ? :
162 18 130 if ($Tree::XPathEngine::CACHE{$path})
170 1 125 if ($$self{'_tokpos'} < scalar @$tokens)
177 0 125 if $Tree::XPathEngine::DEBUG
189 0 130 if $Tree::XPathEngine::DEBUG
197 9 1309 if ($expected eq 'RE' and $path =~ /\G\s*($Tree::XPathEngine::REGEXP_RE $Tree::XPathEngine::REGEXP_MOD_RE?)\s*/cgsx) { }
1179 130 elsif ($path =~ m{\G \s* # ignore all whitespace ( # tokens $Tree::XPathEngine::LITERAL| # literal string $Tree::XPathEngine::NUMBER_RE| # digits \.\.| # parent \.| # current ($Tree::XPathEngine::AXIS_NAME)?$Tree::XPathEngine::NODE_TYPE| # node type test (probably useless in this context) \@($$self{'NAME'}|$Tree::XPathEngine::WILD)| # attribute \$$$self{'NAME'}| # variable reference ($Tree::XPathEngine::AXIS_NAME)?($$self{'NAME'}|$Tree::XPathEngine::WILD)| # NAME,NodeType,Axis::Test \!=|<=|\-|>=|//|and|or|mod|div| # multi-char seps =~|\!~| # regexp matching (not in the XPath spec) [,\+=\|<>/\(\[\]\)]| # single char seps (?
221 9 1170 $token =~ /^[=!]~$/ ? :
226 1059 129 if (length $token)
228 0 1059 if $Tree::XPathEngine::DEBUG
233 1 129 if (pos $path < length $path)
259 1250 4823 unless $$self{'_tokpos'} < @$tokens
265 876 3947 if ($$tokens[$$self{'_tokpos'}] =~ /^$match$/) { }
271 1 3946 if ($fatal) { }
283 0 301 if $Tree::XPathEngine::DEBUG
291 0 301 if $Tree::XPathEngine::DEBUG
311 0 302 if $Tree::XPathEngine::DEBUG
331 0 304 if $Tree::XPathEngine::DEBUG
352 0 313 if $Tree::XPathEngine::DEBUG
372 0 384 if $Tree::XPathEngine::DEBUG
392 0 402 if $Tree::XPathEngine::DEBUG
412 0 414 if $Tree::XPathEngine::DEBUG
432 0 420 if $Tree::XPathEngine::DEBUG
434 2 418 if (_match($self, $tokens, '-')) { }
449 0 418 if $Tree::XPathEngine::DEBUG
469 0 420 if $Tree::XPathEngine::DEBUG
482 113 307 if ($test =~ m[^(//?|\.\.?)$]) { }
42 265 elsif (_is_step($self, $tokens)) { }
495 0 264 if (_match($self, $tokens, '//?'))
498 0 0 if ($$self{'_curr_match'} eq '//')
515 0 265 if $Tree::XPathEngine::DEBUG
530 0 265 if $Tree::XPathEngine::DEBUG
534 81 184 if (_match($self, $tokens, $Tree::XPathEngine::LITERAL)) { }
9 175 elsif (_match($self, $tokens, "$Tree::XPathEngine::REGEXP_RE$Tree::XPathEngine::REGEXP_MOD_RE?")) { }
103 72 elsif (_match($self, $tokens, $Tree::XPathEngine::NUMBER_RE)) { }
25 47 elsif (_match($self, $tokens, '\\(')) { }
0 47 elsif (_match($self, $tokens, "\\\$$$self{'NAME'}")) { }
46 1 elsif (_match($self, $tokens, $$self{'NAME'})) { }
544 0 9 if ($mod)
584 0 46 if $Tree::XPathEngine::DEBUG
588 13 33 if ($$tokens[$$self{'_tokpos'}] eq ')')
603 0 155 if $Tree::XPathEngine::DEBUG
607 18 137 if (_match($self, $tokens, '/')) { }
69 68 elsif (_match($self, $tokens, '//')) { }
609 0 18 if $Tree::XPathEngine::DEBUG
611 18 0 if (_is_step($self, $tokens))
612 0 18 if $Tree::XPathEngine::DEBUG
620 62 7 if (not $optimised) { }
639 0 72 if $Tree::XPathEngine::DEBUG
644 61 11 if ($$tokens[$tokpos + 1] and $$tokens[$tokpos + 1] eq '[') { }
0 11 elsif ($$tokens[$tokpos] =~ /^\.\.?$/) { }
653 0 11 if $Tree::XPathEngine::DEBUG
655 4 7 if ($$step{'axis'} ne 'child')
671 0 155 if $Tree::XPathEngine::DEBUG
677 3 42 if ($$self{'_curr_match'} eq '//')
679 3 0 if (not $optimised) { }
688 0 44 if (@steps > 1 and $steps[-1]{'axis'} eq 'self' and $steps[-1]{'test'} == 5)
701 0 211 if $Tree::XPathEngine::DEBUG
703 32 179 if (_match($self, $tokens, '\\.')) { }
3 176 elsif (_match($self, $tokens, '\\.\\.')) { }
715 0 176 if $Tree::XPathEngine::DEBUG
718 82 94 if ($token =~ /^\@($$self{'NAME'}|$Tree::XPathEngine::WILD)$/) { }
15 79 elsif ($token =~ /^$Tree::XPathEngine::WILD$/) { }
66 13 elsif ($token =~ /^$$self{'NAME'}$/) { }
0 13 elsif ($token eq 'text()') { }
0 13 elsif ($token eq 'node()') { }
12 1 elsif ($token =~ /^($Tree::XPathEngine::AXIS_NAME)($$self{'NAME'}|$Tree::XPathEngine::WILD|$Tree::XPathEngine::NODE_TYPE)$/) { }
720 10 72 if ($token eq '@*') { }
72 0 elsif ($token =~ /^\@($$self{'NAME'})$/) { }
759 10 2 if ($token =~ /^$Tree::XPathEngine::WILD$/) { }
2 0 elsif ($token =~ /^$$self{'NAME'}$/) { }
0 0 elsif ($token eq 'text()') { }
0 0 elsif ($token eq 'node()') { }
760 0 10 $axis eq 'attribute' ? :
768 0 2 $axis eq 'attribute' ? :
805 0 325 unless defined $token
807 0 325 if $Tree::XPathEngine::DEBUG
811 60 265 if ($token eq 'processing-instruction' or $token =~ /^\@($$self{'NAME'}|$Tree::XPathEngine::WILD)$/ or $token =~ /^($$self{'NAME'}|$Tree::XPathEngine::WILD)$/ and ($$tokens[$$self{'_tokpos'} + 1] || '') ne '(' or $token =~ /^$Tree::XPathEngine::NODE_TYPE$/ or $token =~ /^$Tree::XPathEngine::AXIS_NAME($$self{'NAME'}|$Tree::XPathEngine::WILD|$Tree::XPathEngine::NODE_TYPE)$/) { }
820 0 265 if $Tree::XPathEngine::DEBUG