Branch Coverage

blib/lib/PPI/Document.pm
Criterion Covered Total %
branch 81 116 69.8


line true false branch
147 0 33532 ref $_[0] ? :
149 16767 16765 unless (@_)
161 0 16765 if (not defined $source) { }
505 16260 elsif (not ref $source) { }
16257 3 elsif (&_SCALAR0($source)) { }
3 0 elsif (&_ARRAY0($source)) { }
166 0 505 if ($source =~ /(?:\012|\015)/)
174 3 502 if ($CACHE) { }
178 0 3 unless ref $file_contents
182 2 1 if $document
185 1 0 if ($document)
192 502 0 if $document
197 16256 1 if $document
202 3 0 if $document
210 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 0 elsif ($@) { }
0 0 elsif ('PPI::Lexer'->errstr) { }
258 0 3 ref $_[0] ? :
260 2 1 if (defined $_[0]) { }
262 0 2 unless my $object = &_INSTANCE(shift(), "PPI::Cache")
343 55970 2 unless @_
362 0 2 unless open FILE, ">", $_[0]
364 0 2 unless print FILE $self->serialize
365 0 2 unless close FILE
402 266512 606 unless ($Token->isa("PPI::Token::HereDoc"))
406 266093 419 unless ($heredoc ne "" and $content =~ /\n/)
413 295 124 if ($content eq "\n") { }
436 138 817 "\n" eq $line ? :
439 462 144 if ($Token->{'_damaged'})
452 287 175 if ($tokens[$last_index]{'content'} =~ /^[^\n]*\n$/)
460 1251 0 if $tokens[$_]
462 0 462 unless (defined $last_line)
476 2 1536 if $tokens[$_]->isa("PPI::Token::HereDoc")
477 0 462 unless (defined $any_after)
484 0 462 unless ($last_line and not $any_after)
486 0 0 unless (defined $Token->{'_terminator_line'})
492 0 0 unless ($Token->{'_terminator_line'} =~ /\n$/)
499 151 455 if (defined $Token->{'_terminator_line'})
506 0 7203 if ($heredoc ne "")
509 0 0 unless ($output =~ /\n$/)
574 0 258 if $Token->{'_location'}
578 0 258 if ($_) { }
582 258 0 $self->can('filename') ? :
591 258 1 if (defined $first)
598 34 66559 if ($Token->isa("PPI::Token::HereDoc"))
616 55688 10905 unless ($newlines)
635 31 10874 if ($heredoc and $$heredoc)
643 281 10624 if ($content =~ /\n([^\n]+?)\z/)
659 10650 55943 if ($start->[1] == 1)
660 1764 8886 if ($Token->isa('PPI::Token::Comment')) { }
344 8542 elsif ($Token->isa('PPI::Token::Pod')) { }
661 13 1751 if ($Token->content =~ / \A \# \s* line \s+ (\d+) \s* (?: (\"?) ([^\"]* [^\s\"]) \2 )? \s* \z /msx)
695 6 338 if (defined $line)
714 51715 4254 unless $content =~ /\t/
719 7803 7855 if ($part eq "\t") { }
788 0 15 if $_[1]->isa("PPI::Structure")
792 0 2 if $self->find_any(sub { not $_[1]->complete if $_[1]->isa("PPI::Structure"); } )
801 0 2 unless @child