Branch Coverage

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


line true false branch
147 0 33418 ref $_[0] ? :
149 16710 16708 unless (@_)
161 0 16708 if (not defined $source) { }
499 16209 elsif (not ref $source) { }
16206 3 elsif (&_SCALAR0($source)) { }
3 0 elsif (&_ARRAY0($source)) { }
166 0 499 if ($source =~ /(?:\012|\015)/)
174 3 496 if ($CACHE) { }
178 0 3 unless ref $file_contents
182 2 1 if $document
185 1 0 if ($document)
192 496 0 if $document
197 16205 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 55785 2 unless @_
362 0 2 unless open FILE, ">", $_[0]
364 0 2 unless print FILE $self->serialize
365 0 2 unless close FILE
402 264911 603 unless ($Token->isa("PPI::Token::HereDoc"))
406 264495 416 unless ($heredoc ne "" and $content =~ /\n/)
413 294 122 if ($content eq "\n") { }
436 138 810 "\n" eq $line ? :
439 459 144 if ($Token->{'_damaged'})
452 284 175 if ($tokens[$last_index]{'content'} =~ /^[^\n]*\n$/)
460 1233 0 if $tokens[$_]
462 0 459 unless (defined $last_line)
476 2 1515 if $tokens[$_]->isa("PPI::Token::HereDoc")
477 0 459 unless (defined $any_after)
484 0 459 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 452 if (defined $Token->{'_terminator_line'})
506 0 7058 if ($heredoc ne "")
509 0 0 unless ($output =~ /\n$/)
574 0 254 if $Token->{'_location'}
578 0 254 if ($_) { }
582 254 0 $self->can('filename') ? :
591 254 1 if (defined $first)
598 34 66372 if ($Token->isa("PPI::Token::HereDoc"))
616 55504 10902 unless ($newlines)
635 31 10871 if ($heredoc and $$heredoc)
643 280 10622 if ($content =~ /\n([^\n]+?)\z/)
659 10648 55758 if ($start->[1] == 1)
660 1767 8881 if ($Token->isa('PPI::Token::Comment')) { }
344 8537 elsif ($Token->isa('PPI::Token::Pod')) { }
661 13 1754 if ($Token->content =~ / \A \# \s* line \s+ (\d+) \s* (?: (\"?) ([^\"]* [^\s\"]) \2 )? \s* \z /msx)
695 6 338 if (defined $line)
714 51524 4260 unless $content =~ /\t/
719 7805 7856 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