Branch Coverage

blib/lib/Perl/MinimumVersion.pm
Criterion Covered Total %
branch 278 394 70.5


line true false branch
160 0 205 ref $_[0] ? :
161 3 202 unless my $Document = _Document(shift())
216 0 56 unless my $self = _SELF(\@_)
221 0 56 unless defined $explicit
222 1 55 if ($explicit and $explicit > $minimum)
230 0 56 unless defined $syntax
231 40 16 if ($syntax and $syntax > $minimum)
247 0 0 unless my $self = _SELF(\@_)
252 0 0 unless defined $explicit
253 0 0 if ($explicit and $explicit > $minimum)
286 0 57 unless my $self = _SELF(\@_)
288 3 54 $reason ? :
292 0 57 unless my $self = _SELF(\@_)
293 57 0 unless (defined $self->{'explicit'})
300 0 57 unless my $self = shift()
302 566 25 unless $_[1]->isa("PPI::Statement::Include")
303 21 4 unless $_[1]->version
306 54 3 unless $explicit
313 4 0 if (not $element or $version > $max)
355 0 62 unless my $self = _SELF(\@_)
357 43 19 $reason ? :
361 0 65 unless my $self = _SELF(\@_)
363 1 64 if (defined $limit and not &_INSTANCE($limit, "version"))
366 5 60 if (defined $self->{'syntax'})
367 4 1 if (not defined $limit or $self->{'syntax'}->version >= $limit)
383 42 18 if ($syntax)
400 1 0 unless defined $value
409 59 1 unless $self->{'_checks2skip'}
414 1 419 if exists $checks2skip{$rule}
417 19 400 if ($v > $filter)
423 1 18 if ($self->{'_collect_all_reasons'}) { }
438 1380 0 if not exists $checks2skip{$_}
442 682 25 unless my $result = $self->$rule
450 0 25 if ($self->{'_collect_all_reasons'}) { }
479 0 0 unless my $self = _SELF(\@_)
481 0 0 $reason ? :
485 0 0 unless my $self = _SELF(\@_)
486 0 0 unless (defined $self->{'external'})
513 0 1 unless my $self = _SELF(\@_)
517 1 0 if (my $explicit = $self->minimum_explicit_version)
522 22 1 unless $self->$check
572 723 49 unless $_[1]->isa("PPI::Statement::Include")
573 18 31 unless $_[1]->pragma eq "feature"
578 11 81 if $arg->content =~ /:(5\.\d+)(?:\.\d+)?/
579 20 72 if $arg->content =~ /\b($feature_regexp)\b/
581 29 63 if ($v and $v > ($version || 0))
588 28 56 defined $version ? :
622 589 2 unless $_[1]->isa("PPI::Statement::Include") and $_[1]->pragma eq "experimental"
629 0 5 if $arg->content =~ /:(5\.\d+)(?:\.\d+)?/
630 1 4 if $arg->content =~ /\b($experimental_regexp)\b/
632 1 4 if ($v and $v > ($version || 0))
640 1 59 defined $version ? :
656 587 4 unless $_[1]->isa("PPI::Statement::Scheduled")
657 0 4 unless ($_[1]->children)[0]->isa("PPI::Token::Word")
659 1 3 unless exists $SCHEDULED_BLOCK{$function}
662 3 0 if ($v and $v > ($version || 0))
669 3 57 defined $version ? :
678 593 13 unless grep {$_[1]->isa($_);} "PPI::Token::QuoteLike::Regexp", "PPI::Token::Regexp::Match", "PPI::Token::Regexp::Substitute"
682 13 0 if ($v and $v > ($version || 0))
690 604 2 unless $_[1]->isa("PPI::Token::Regexp::Transliterate")
692 2 0 if (exists $_[1]->get_modifiers->{'r'} and $tr_r_version > ($version || 0))
700 3 65 if $version and $version eq "5.000"
708 577 9 unless $_[1]->isa("PPI::Statement::Include") and $_[1]->module eq 're' || $_[1]->pragma eq 're'
711 4 5 $included->can('literal') ? :
714 7 1 if @flags
719 8 0 if ($v and $v > ($version || 0))
725 0 60 if $version and $version eq "5.000"
732 771 128 unless $_[1]->isa("PPI::Token::Word")
733 84 44 unless $_[1]->content =~ /^(each|keys|values)$/
734 2 42 if is_method_call($_[1])
736 16 25 if $next->isa("PPI::Structure::List")
737 4 37 if ($next->isa('PPI::Token::Cast')) { }
28 9 elsif ($next->isa('PPI::Token::Symbol')) { }
1 8 elsif ($next->isa('PPI::Token::Operator')) { }
2 6 elsif ($_[1]->parent->isa('PPI::Statement::Sub')) { }
738 3 1 if ($next->content eq '@' and 5.012 > ($version || 0)) { }
0 2 elsif ($next->content eq '$' and 5.014 > ($version || 0)) { }
746 7 21 if ($next->raw_type eq '@' and 5.012 > ($version || 0)) { }
14 14 elsif ($next->raw_type eq '$' and 5.014 > ($version || 0)) { }
758 6 0 if ("5.014" > ($version || 0))
763 21 17 if $version and $version == "5.014"
766 29 73 defined $version ? :
773 3 8 if $s eq $str
783 581 82 unless $main_element->isa("PPI::Token::Word")
784 72 10 unless $main_element->content eq "binmode"
785 0 10 if is_hash_key($main_element)
786 0 10 if is_method_call($main_element)
787 0 10 if is_subroutine_name($main_element)
788 0 10 if is_included_module_name($main_element)
789 0 10 if is_package_declaration($main_element)
791 8 2 if (scalar @arguments == 2)
793 7 1 if ($arg2->isa("PPI::Token::Quote"))
798 3 1 unless (_str_in_list($str, (":raw", ":crlf")) or $str =~ /[\$\@\%]/)
804 5 0 unless ($version)
820 415 59 unless $_[1]->isa("PPI::Token::Word")
821 51 8 unless $_[1]->content eq "while"
822 0 8 if is_hash_key($_[1])
823 0 8 if is_method_call($_[1])
824 1 7 unless my $e1 = $_[1]->next_sibling
825 7 0 if ($e1->isa("PPI::Structure::Condition"))
829 0 7 unless $e1->isa("PPI::Statement::Expression")
833 1 6 unless $e1->isa("PPI::Token::Word")
834 1 5 unless $e1->content eq "readdir"
835 0 5 if @children == 1
836 2 3 if @children > 2
838 0 3 unless $e1->isa("PPI::Structure::List") or $e1->isa("PPI::Token::Symbol")
849 14 315 if $_[1]->isa("PPI::Statement::Include")
855 294 50 unless $_[1]->isa("PPI::Statement")
859 21 29 unless $main_element->isa("PPI::Token::Word")
860 22 7 unless $main_element->content eq "open"
862 5 2 if (scalar @arguments == 3 and scalar @{$arguments[2];} == 1)
864 3 2 if ($arg3->isa("PPI::Token::Word") and $arg3->content eq "undef")
874 297 51 unless $_[1]->isa("PPI::Statement")
878 21 30 unless $main_element->isa("PPI::Token::Word")
879 22 8 unless $main_element->content eq "open"
881 6 2 if (scalar @arguments == 3)
883 4 2 if ($arg3->isa("PPI::Token::Cast") and $arg3->content eq "\\")
893 0 10 if ($elem->isa('PPI::Token::Cast')) { }
10 0 elsif ($elem->isa('PPI::Token::Symbol')) { }
905 568 2 unless $main_element->isa("PPI::Token::HereDoc")
906 1 1 unless $main_element->content =~ /^\<\<\~/
928 0 4 unless my $next = $elem->snext_sibling
940 498 11 unless $main_element->isa("PPI::Token::Cast")
941 0 11 unless my $prev = $main_element->sprevious_sibling
943 1 10 unless $prev->isa("PPI::Token::Operator") and $prev->content eq "->"
945 0 10 unless $prev = $prev->sprevious_sibling
947 0 10 unless $prev->isa("PPI::Token::Symbol") and (_get_resulting_sigil($prev) || '') eq "\$"
949 0 10 unless my $code = $postfix_deref{$main_element->content}
958 389 53 unless $main_element->isa("PPI::Token::Word")
959 48 5 unless $main_element->content eq "when"
960 0 5 if is_hash_key($main_element)
961 0 5 if is_method_call($main_element)
962 0 5 if is_subroutine_name($main_element)
963 0 5 if is_included_module_name($main_element)
964 0 5 if is_package_declaration($main_element)
966 0 5 unless $stmnt
967 2 3 if $stmnt->isa("PPI::Statement::When")
974 461 8 unless $_[1]->isa("PPI::Token::Operator") and $_[1]->content eq "..."
977 5 3 if @child == 1
978 1 2 if (@child == 2)
986 7 324 if $_[1]->isa("PPI::Statement::Variable") and ($_[1]->children)[0]->isa("PPI::Token::Word")
994 0 0 unless $_[1]->isa("PPI::Statement::Compound")
995 0 0 unless $_[1]->schild(0)->isa("PPI::Token::Label")
999 0 0 if ($next->isa("PPI::Statement::Compound") and $next->schild(0)->isa("PPI::Token::Label"))
1010 24 253 if $_[1]->isa("PPI::Statement") and ($_[1]->children)[0]->isa("PPI::Token::Word")
1018 411 9 unless $_[1]->isa("PPI::Statement::Package")
1020 0 9 unless $child[0]->isa("PPI::Token::Word")
1021 0 9 unless $child[0]->content eq "package"
1022 0 9 unless $child[1]->isa("PPI::Token::Word")
1023 3 6 unless $child[2]->isa("PPI::Token::Number")
1032 12 243 if $_[1]->isa("PPI::Statement::Include")
1040 23 341 if $_[1]->isa("PPI::Token::Operator")
1048 4 335 if $_[1]->isa("PPI::Token::Magic")
1056 10 193 if $_[1]->isa("PPI::Statement::Include")
1070 2 2 if $_[1]->isa("PPI::Token::Magic")
1073 0 2 unless $Document->find_any(sub { $_[1]->symbol eq "\$!" if $_[1]->isa("PPI::Token::Magic"); } )
1080 248 31 unless $_[1]->isa("PPI::Token::Word")
1081 31 0 unless $_[1] eq "utf8::is_utf"
1089 262 17 unless $_[1]->isa("PPI::Token::Number")
1090 17 0 unless $_[1]{'_subtype'}
1091 0 0 unless $_[1]{'_subtype'} eq "base256"
1092 0 0 unless my $stmt = $_[1]->parent
1093 0 0 unless my $braces = $stmt->parent
1094 0 0 unless $braces->isa("PPI::Structure")
1095 0 0 unless $braces->braces eq "()"
1096 0 0 unless my $new = $braces->previous_sibling
1097 0 0 unless $new->isa("PPI::Token::Word")
1098 0 0 unless $new->content eq "new"
1099 0 0 unless my $method = $new->previous_sibling
1100 0 0 unless $method->isa("PPI::Token::Operator")
1101 0 0 unless $method->content eq "->"
1102 0 0 unless my $_class = $method->previous_sibling
1103 0 0 unless $_class->isa("PPI::Token::Word")
1104 0 0 unless $_class->content eq "version"
1111 9 208 if $_[1]->isa("PPI::Statement::Include")
1125 2 8 if $_[1]->isa("PPI::Statement::Include") and $_[1]->type and $_[1]->type eq "use" and $_[1]->module eq "constant"
1140 225 3 unless $_[1]->isa("PPI::Statement::Variable")
1141 1 2 unless $_[1]->type eq "local"
1145 0 2 unless scalar @child >= 2
1146 0 2 unless $child[1]->isa("PPI::Token::Cast")
1147 0 2 unless $child[1]->content eq "\$"
1150 0 2 unless $child[2]->isa("PPI::Structure::Block")
1153 0 2 unless my $statement = $child[2]->schild(0)
1154 0 2 unless $statement->isa("PPI::Statement")
1155 0 2 unless my $inside = $statement->schild(0)
1156 0 2 unless $inside->isa("PPI::Token::Quote")
1167 217 9 unless $_[1]->isa("PPI::Statement::Include")
1168 9 0 unless $_[1]->module eq "Carp"
1179 559 2 unless $_[1]->isa("PPI::Token::QuoteLike::Readline")
1180 1 1 unless $_[1]->content eq "<<>>"
1191 296 2 if (&_INSTANCE($param->[0], "Perl::MinimumVersion"))
1194 2 0 if (&_CLASS($param->[0]) and $param->[0]->isa("Perl::MinimumVersion"))
1208 9 9 if defined $_[0] and "$_[0]" eq "Perl::MinimumVersion"
1212 0 26 $_->isa('Perl::MinimumVersion::Reason') ? :
1214 36 0 unless &_INSTANCE($_, "Perl::MinimumVersion::Reason")
6 12 unless my(@valid) = map({[$_, $_->isa("Perl::MinimumVersion::Reason") ? $_->version : $_];} grep({&_INSTANCE($_, "version") unless &_INSTANCE($_, "Perl::MinimumVersion::Reason");} @_))
1222 4 10 if $it->[1] > $max->[1]