Branch Coverage

blib/lib/Perl/MinimumVersion.pm
Criterion Covered Total %
branch 352 476 73.9


line true false branch
196 0 260 ref $_[0] ? :
197 3 257 unless my $Document = _Document(shift())
252 0 42 unless my $self = _SELF(\@_)
257 0 42 unless defined $explicit
258 2 40 if ($explicit and $explicit > $minimum)
266 0 42 unless defined $syntax
267 30 12 if ($syntax and $syntax > $minimum)
283 0 0 unless my $self = _SELF(\@_)
288 0 0 unless defined $explicit
289 0 0 if ($explicit and $explicit > $minimum)
322 0 43 unless my $self = _SELF(\@_)
324 3 40 $reason ? :
328 0 43 unless my $self = _SELF(\@_)
329 42 1 unless (defined $self->{'explicit'})
336 0 42 unless my $self = shift()
338 489 16 unless $_[1]->isa('PPI::Statement::Include')
339 12 4 unless $_[1]->version
342 39 3 unless $explicit
349 4 0 if (not $element or $version > $max)
391 0 48 unless my $self = _SELF(\@_)
393 35 13 $reason ? :
397 0 51 unless my $self = _SELF(\@_)
399 1 50 if (defined $limit and not &_INSTANCE($limit, 'version'))
402 5 46 if (defined $self->{'syntax'})
403 4 1 if (not defined $limit or $self->{'syntax'}->version >= $limit)
419 34 12 if ($syntax)
436 1 0 unless defined $value
445 45 1 unless $self->{'_checks2skip'}
450 1 275 if exists $checks2skip{$rule}
453 15 260 if ($v > $filter)
459 1 14 if ($self->{'_collect_all_reasons'}) { }
474 1977 1 if not exists $checks2skip{$_}
478 1000 24 unless my $result = $self->$rule
486 2 22 if ($self->{'_collect_all_reasons'}) { }
515 0 0 unless my $self = _SELF(\@_)
517 0 0 $reason ? :
521 0 0 unless my $self = _SELF(\@_)
522 0 0 unless (defined $self->{'external'})
549 0 1 unless my $self = _SELF(\@_)
553 1 0 if (my $explicit = $self->minimum_explicit_version)
558 40 3 unless $self->$check
608 648 40 unless $_[1]->isa('PPI::Statement::Include')
609 9 31 unless $_[1]->pragma eq 'feature'
614 11 81 if $arg->content =~ /:(5\.\d+)(?:\.\d+)?/
615 20 72 if $arg->content =~ /\b($feature_regexp)\b/
617 29 63 if ($v and $v > ($version || 0))
624 28 42 defined $version ? :
658 505 2 unless $_[1]->isa('PPI::Statement::Include') and $_[1]->pragma eq 'experimental'
665 0 5 if $arg->content =~ /:(5\.\d+)(?:\.\d+)?/
666 1 4 if $arg->content =~ /\b($experimental_regexp)\b/
668 1 4 if ($v and $v > ($version || 0))
676 1 45 defined $version ? :
692 503 4 unless $_[1]->isa('PPI::Statement::Scheduled')
693 0 4 unless ($_[1]->children)[0]->isa('PPI::Token::Word')
695 1 3 unless exists $SCHEDULED_BLOCK{$function}
698 3 0 if ($v and $v > ($version || 0))
705 3 43 defined $version ? :
713 496 14 unless grep {$_[1]->isa($_);} 'PPI::Token::QuoteLike::Regexp', 'PPI::Token::Regexp::Match', 'PPI::Token::Regexp::Substitute'
717 14 0 if ($v and $v > ($version || 0))
723 4 48 if $version and $version eq '5.000'
730 698 117 unless $_[1]->isa('PPI::Token::Word')
731 73 44 unless $_[1]->content =~ /^(each|keys|values)$/
732 2 42 if is_method_call($_[1])
734 16 25 if $next->isa('PPI::Structure::List')
735 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')) { }
736 3 1 if ($next->content eq '@' and 5.012 > ($version || 0)) { }
0 2 elsif ($next->content eq '$' and 5.014 > ($version || 0)) { }
744 7 21 if ($next->raw_type eq '@' and 5.012 > ($version || 0)) { }
14 14 elsif ($next->raw_type eq '$' and 5.014 > ($version || 0)) { }
756 6 0 if (5.014 > ($version || 0))
761 21 17 if $version and $version == 5.014
764 29 59 defined $version ? :
771 3 8 if $s eq $str
781 508 71 unless $main_element->isa('PPI::Token::Word')
782 61 10 unless $main_element->content eq 'binmode'
783 0 10 if is_hash_key($main_element)
784 0 10 if is_method_call($main_element)
785 0 10 if is_subroutine_name($main_element)
786 0 10 if is_included_module_name($main_element)
787 0 10 if is_package_declaration($main_element)
789 8 2 if (scalar @arguments == 2)
791 7 1 if ($arg2->isa('PPI::Token::Quote'))
796 3 1 unless (_str_in_list($str, (':raw', ':crlf')) or $str =~ /[\$\@\%]/)
802 5 0 unless ($version)
818 508 71 unless $_[1]->isa('PPI::Token::Word')
819 63 8 unless $_[1]->content eq 'while'
820 0 8 if is_hash_key($_[1])
821 0 8 if is_method_call($_[1])
822 1 7 unless my $e1 = $_[1]->next_sibling
823 7 0 if ($e1->isa('PPI::Structure::Condition'))
827 0 7 unless $e1->isa('PPI::Statement::Expression')
831 1 6 unless $e1->isa('PPI::Token::Word')
832 1 5 unless $e1->content eq 'readdir'
833 0 5 if @children == 1
834 2 3 if @children > 2
836 0 3 unless $e1->isa('PPI::Structure::List') or $e1->isa('PPI::Token::Symbol')
847 11 393 if $_[1]->isa('PPI::Statement::Include')
853 296 42 unless $_[1]->isa('PPI::Token::Word')
854 32 10 unless $_[1]->content eq 'sort'
855 0 10 unless is_function_call($_[1])
857 1 9 unless $e1->isa('PPI::Token::Whitespace')
859 2 7 unless _get_resulting_sigil($e1) or !1
861 1 6 unless $e1->isa('PPI::Token::Whitespace')
863 1 3 unless $e1->isa('PPI::Token::Word') or $e1->isa('PPI::Token::Symbol') or $e1->isa('PPI::Token::Cast') or $e1->isa('PPI::Structure::List')
871 331 60 unless $_[1]->isa('PPI::Statement')
875 26 34 unless $main_element->isa('PPI::Token::Word')
876 27 7 unless $main_element->content eq 'open'
878 5 2 if (scalar @arguments == 3 and scalar @{$arguments[2];} == 1)
880 3 2 if ($arg3->isa('PPI::Token::Word') and $arg3->content eq 'undef')
890 334 61 unless $_[1]->isa('PPI::Statement')
894 26 35 unless $main_element->isa('PPI::Token::Word')
895 27 8 unless $main_element->content eq 'open'
897 6 2 if (scalar @arguments == 3)
899 4 2 if ($arg3->isa('PPI::Token::Cast') and $arg3->content eq '\\')
912 5 355 if ($elem->isa('PPI::Token::Word') and $elem eq 'exists' and is_function_call($elem) and $elem = first_arg($elem) and (_get_resulting_sigil($elem) || '') eq '&') { }
926 3 16 if ($elem->isa('PPI::Token::Cast')) { }
13 3 elsif ($elem->isa('PPI::Token::Symbol')) { }
939 463 61 unless $main_element->isa('PPI::Token::Word')
940 56 5 unless $main_element->content eq 'when'
941 0 5 if is_hash_key($main_element)
942 0 5 if is_method_call($main_element)
943 0 5 if is_subroutine_name($main_element)
944 0 5 if is_included_module_name($main_element)
945 0 5 if is_package_declaration($main_element)
947 0 5 unless $stmnt
948 2 3 if $stmnt->isa('PPI::Statement::When')
955 543 8 unless $_[1]->isa('PPI::Token::Operator') and $_[1]->content eq '...'
958 5 3 if @child == 1
959 1 2 if (@child == 2)
967 11 410 if $_[1]->isa('PPI::Statement::Variable') and ($_[1]->children)[0]->isa('PPI::Token::Word')
975 0 0 unless $_[1]->isa('PPI::Statement::Compound')
976 0 0 unless $_[1]->schild(0)->isa('PPI::Token::Label')
980 0 0 if ($next->isa('PPI::Statement::Compound') and $next->schild(0)->isa('PPI::Token::Label'))
991 29 295 if $_[1]->isa('PPI::Statement') and ($_[1]->children)[0]->isa('PPI::Token::Word')
999 493 9 unless $_[1]->isa('PPI::Statement::Package')
1001 0 9 unless $child[0]->isa('PPI::Token::Word')
1002 0 9 unless $child[0]->content eq 'package'
1003 0 9 unless $child[1]->isa('PPI::Token::Word')
1004 3 6 unless $child[2]->isa('PPI::Token::Number')
1013 11 301 if $_[1]->isa('PPI::Statement::Include')
1021 26 400 if $_[1]->isa('PPI::Token::Operator')
1029 8 393 if $_[1]->isa('PPI::Token::Magic')
1037 7 288 if $_[1]->isa('PPI::Statement::Include')
1051 2 2 if $_[1]->isa('PPI::Token::Magic')
1054 0 2 unless $Document->find_any(sub { $_[1]->symbol eq '$!' if $_[1]->isa('PPI::Token::Magic'); } )
1061 339 42 unless $_[1]->isa('PPI::Token::Word')
1062 42 0 unless $_[1] eq 'utf8::is_utf'
1070 360 21 unless $_[1]->isa('PPI::Token::Number')
1071 21 0 unless $_[1]{'_subtype'}
1072 0 0 unless $_[1]{'_subtype'} eq 'base256'
1073 0 0 unless my $stmt = $_[1]->parent
1074 0 0 unless my $braces = $stmt->parent
1075 0 0 unless $braces->isa('PPI::Structure')
1076 0 0 unless $braces->braces eq '()'
1077 0 0 unless my $new = $braces->previous_sibling
1078 0 0 unless $new->isa('PPI::Token::Word')
1079 0 0 unless $new->content eq 'new'
1080 0 0 unless my $method = $new->previous_sibling
1081 0 0 unless $method->isa('PPI::Token::Operator')
1082 0 0 unless $method->content eq '->'
1083 0 0 unless my $_class = $method->previous_sibling
1084 0 0 unless $_class->isa('PPI::Token::Word')
1085 0 0 unless $_class->content eq 'version'
1092 8 324 if $_[1]->isa('PPI::Statement::Include')
1106 2 7 if $_[1]->isa('PPI::Statement::Include') and $_[1]->type and $_[1]->type eq 'use' and $_[1]->module eq 'constant'
1122 7 231 if $_[1]->isa('PPI::Statement::Include')
1128 5 238 if $_[1]->isa('PPI::Statement::Variable')
1149 4 270 if $_[1]->isa('PPI::Token::Magic')
1161 1 273 if $_[1]->isa('PPI::Statement::Scheduled')
1175 4 145 if $_[1]->isa('PPI::Statement::Include')
1183 3 151 if $_[1]->isa('PPI::Statement::Include') and $_[1]->module
1205 2 152 if $_[1]->isa('PPI::Statement::Sub')
1217 1 172 if $_[1]->isa('PPI::Statement::Scheduled')
1226 308 8 unless $_[1]->isa('PPI::Statement::Variable')
1227 6 2 unless $_[1]->type eq 'local'
1231 0 2 unless scalar @child >= 2
1232 0 2 unless $child[1]->isa('PPI::Token::Cast')
1233 0 2 unless $child[1]->content eq '$'
1236 0 2 unless $child[2]->isa('PPI::Structure::Block')
1239 0 2 unless my $statement = $child[2]->schild(0)
1240 0 2 unless $statement->isa('PPI::Statement')
1241 0 2 unless my $inside = $statement->schild(0)
1242 0 2 unless $inside->isa('PPI::Token::Quote')
1253 307 7 unless $_[1]->isa('PPI::Statement::Include')
1254 7 0 unless $_[1]->module eq 'Carp'
1263 237 50 unless $_[1]->isa('PPI::Statement')
1267 20 30 unless $main_element->isa('PPI::Token::Word')
1268 17 13 unless $main_element->content eq 'open'
1270 7 6 if (scalar @arguments > 2)
1280 219 29 unless $main_element->isa('PPI::Token::Word')
1281 22 7 unless $main_element->content eq 'substr'
1282 0 7 if is_hash_key($main_element)
1283 1 6 if is_method_call($main_element)
1284 0 6 if is_subroutine_name($main_element)
1285 0 6 if is_included_module_name($main_element)
1286 0 6 if is_package_declaration($main_element)
1288 3 3 if (scalar @arguments > 3)
1298 217 27 unless $main_element->isa('PPI::Token::Word')
1299 21 6 unless $main_element->content eq 'mkdir'
1300 0 6 if is_hash_key($main_element)
1301 1 5 if is_method_call($main_element)
1302 0 5 if is_subroutine_name($main_element)
1303 0 5 if is_included_module_name($main_element)
1304 0 5 if is_package_declaration($main_element)
1306 3 2 if (scalar @arguments != 2)
1316 203 27 unless $main_element->isa('PPI::Token::Word')
1317 18 9 unless $main_element->content eq 'splice'
1318 0 9 if is_hash_key($main_element)
1319 1 8 if is_method_call($main_element)
1320 0 8 if is_subroutine_name($main_element)
1321 0 8 if is_included_module_name($main_element)
1322 0 8 if is_package_declaration($main_element)
1325 3 5 if (scalar @arguments < 3)
1329 5 0 if (ref $arg eq 'ARRAY')
1332 5 0 if ($arg->isa('PPI::Token::Number'))
1333 3 2 if ($arg->literal < 0) { }
1347 171 26 unless $main_element->isa('PPI::Token::Word')
1348 22 4 unless $main_element->content eq 'foreach'
1349 0 4 if is_hash_key($main_element)
1350 0 4 if is_method_call($main_element)
1351 0 4 if is_subroutine_name($main_element)
1352 0 4 if is_included_module_name($main_element)
1353 0 4 if is_package_declaration($main_element)
1355 0 4 unless $stmnt
1356 1 3 if $stmnt->isa('PPI::Statement::Compound')
1366 322 3 unless $_[1]->isa('PPI::Statement::Include') and $_[1]->module eq 'Scalar::Util' and $_[1]->content =~ /[^:]\b(?:weaken|isweak)\b[^:]/
1389 4 163 if $_[1]->isa('PPI::Token::Magic')
1398 26 163 if $_[1]->isa('PPI::Token::Word')
1412 226 2 if (&_INSTANCE($param->[0], 'Perl::MinimumVersion'))
1415 2 0 if (&_CLASS($param->[0]) and $param->[0]->isa('Perl::MinimumVersion'))
1429 9 9 if defined $_[0] and "$_[0]" eq 'Perl::MinimumVersion'
1433 0 26 $_->isa('Perl::MinimumVersion::Reason') ? :
1435 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');} @_))
1443 4 10 if $it->[1] > $max->[1]