Branch Coverage

blib/lib/PPI/Document.pm
Criterion Covered Total %
branch 88 128 68.7


line true false branch
188 0 33679 ref $_[0] ? :
190 16840 16839 unless (@_)
202 0 16839 if (not defined $source) { }
517 16322 elsif (not ref $source) { }
16319 3 elsif (&_SCALAR0($source)) { }
3 0 elsif (&_ARRAY0($source)) { }
207 0 517 if ($source =~ /(?:\012|\015)/)
215 3 514 if ($CACHE) { }
219 0 3 unless ref $file_contents
223 2 1 if $document
226 1 0 if ($document)
233 513 1 if $document
238 16318 1 if $document
242 3 0 if $document
250 2 0 if ('PPI::Lexer'->errstr) { }
0 0 elsif (&_INSTANCE($@, 'PPI::Exception')) { }
0 0 elsif ($@) { }
275 1 16840 if ($ENV{'PPI_CUSTOM_FEATURE_INCLUDES'})
277 0 1 if $@
282 1 0 unless $document->{'custom_feature_includes'}
310 0 3 ref $_[0] ? :
312 2 1 if (defined $_[0]) { }
314 0 2 unless my $object = &_INSTANCE(shift(), "PPI::Cache")
395 57913 2 unless @_
405 16853 0 unless @_
415 2249 0 unless @_
425 3300 0 unless @_
444 0 2 unless open FILE, ">", $_[0]
446 0 2 unless print FILE $self->serialize
447 0 2 unless close FILE
484 278258 631 unless ($Token->isa("PPI::Token::HereDoc"))
488 277815 443 unless ($heredoc ne "" and $content =~ /\n/)
495 322 121 if ($content eq "\n") { }
518 138 852 "\n" eq $line ? :
521 459 172 if ($Token->{'_damaged'})
534 283 176 if ($tokens[$last_index]{'content'} =~ /^[^\n]*\n$/)
542 1225 0 if $tokens[$_]
544 0 459 unless (defined $last_line)
558 2 1506 if $tokens[$_]->isa("PPI::Token::HereDoc")
559 0 459 unless (defined $any_after)
566 0 459 unless ($last_line and not $any_after)
568 0 0 unless (defined $Token->{'_terminator_line'})
574 0 0 unless ($Token->{'_terminator_line'} =~ /\n$/)
581 179 452 if (defined $Token->{'_terminator_line'})
588 0 7229 if ($heredoc ne "")
591 0 0 unless ($output =~ /\n$/)
656 0 263 if $Token->{'_location'}
660 0 263 $_ ? :
669 263 0 if (defined $first)
676 34 68721 if ($Token->isa("PPI::Token::HereDoc"))
687 266 0 $self->can('filename') ? :
705 57607 11148 unless ($newlines)
724 31 11117 if ($heredoc and $$heredoc)
732 305 10843 if ($content =~ /\n([^\n]+?)\z/)
748 10869 57886 if ($start->[1] == 1)
749 1764 9105 if ($Token->isa('PPI::Token::Comment')) { }
351 8754 elsif ($Token->isa('PPI::Token::Pod')) { }
750 13 1751 if ($Token->content =~ / \A \# \s* line \s+ (\d+) \s* (?: (\"?) ([^\"]* [^\s\"]) \2 )? \s* \z /msx)
784 6 345 if (defined $line)
803 53519 4393 unless $content =~ /\t/
808 7996 8074 if ($part eq "\t") { }
877 0 15 if $_[1]->isa("PPI::Structure")
881 0 2 if $self->find_any(sub { not $_[1]->complete if $_[1]->isa("PPI::Structure"); } )
890 0 2 unless @child