Branch Coverage

blib/lib/PPI/Document.pm
Criterion Covered Total %
branch 90 128 70.3


line true false branch
193 0 33690 ref $_[0] ? :
195 16845 16845 unless (@_)
207 0 16845 if (not defined $source) { }
520 16325 elsif (not ref $source) { }
16322 3 elsif (&_SCALAR0($source)) { }
3 0 elsif (&_ARRAY0($source)) { }
212 0 520 if ($source =~ /(?:\012|\015)/)
220 3 517 if ($CACHE) { }
224 0 3 unless ref $file_contents
228 2 1 if $document
231 1 0 if ($document)
238 516 1 if $document
243 16320 2 if $document
247 3 0 if $document
255 3 0 if ('PPI::Lexer'->errstr) { }
0 0 elsif (&_INSTANCE($@, 'PPI::Exception')) { }
0 0 elsif ($@) { }
280 1 16845 if ($ENV{'PPI_CUSTOM_FEATURE_INCLUDES'})
282 0 1 if $@
287 1 0 unless $document->{'custom_feature_includes'}
315 0 3 ref $_[0] ? :
317 2 1 if (defined $_[0]) { }
319 0 2 unless my $object = &_INSTANCE(shift(), "PPI::Cache")
400 58176 2 unless @_
410 16858 0 unless @_
420 2267 0 unless @_
430 3318 0 unless @_
449 0 2 unless open FILE, ">", $_[0]
451 0 2 unless print FILE $self->serialize
452 0 2 unless close FILE
489 279301 633 unless ($Token->isa("PPI::Token::HereDoc"))
493 278855 446 unless ($heredoc ne "" and $content =~ /\n/)
500 323 123 if ($content eq "\n") { }
523 138 866 "\n" eq $line ? :
526 459 174 if ($Token->{'_damaged'})
539 284 175 if ($tokens[$last_index]{'content'} =~ /^[^\n]*\n$/)
547 1232 0 if $tokens[$_]
549 0 459 unless (defined $last_line)
563 2 1514 if $tokens[$_]->isa("PPI::Token::HereDoc")
564 0 459 unless (defined $any_after)
571 0 459 unless ($last_line and not $any_after)
573 0 0 unless (defined $Token->{'_terminator_line'})
579 0 0 unless ($Token->{'_terminator_line'} =~ /\n$/)
586 181 452 if (defined $Token->{'_terminator_line'})
593 0 7230 if ($heredoc ne "")
596 0 0 unless ($output =~ /\n$/)
661 20 267 if ($Token->{'_location'})
669 1 266 $_ ? :
677 267 0 if (defined $first)
684 34 69025 if ($Token->isa("PPI::Token::HereDoc"))
695 269 0 $self->can('filename') ? :
713 57866 11194 unless ($newlines)
732 31 11163 if ($heredoc and $$heredoc)
740 309 10885 if ($content =~ /\n([^\n]+?)\z/)
756 10911 58149 if ($start->[1] == 1)
757 1764 9147 if ($Token->isa('PPI::Token::Comment')) { }
351 8796 elsif ($Token->isa('PPI::Token::Pod')) { }
758 13 1751 if ($Token->content =~ / \A \# \s* line \s+ (\d+) \s* (?: (\"?) ([^\"]* [^\s\"]) \2 )? \s* \z /msx)
792 6 345 if (defined $line)
811 53778 4397 unless $content =~ /\t/
816 8007 8085 if ($part eq "\t") { }
885 0 15 if $_[1]->isa("PPI::Structure")
889 0 2 if $self->find_any(sub { not $_[1]->complete if $_[1]->isa("PPI::Structure"); } )
898 0 2 unless @child