Branch Coverage

blib/lib/Type/Tiny.pm
Criterion Covered Total %
branch 395 462 85.5


line true false branch
8 0 316 if ($] < "5.01")
86 0 40159 $_[2] ? :
98 0 316 exists $ENV{'PERL_ONLY'} ? :
0 316 exists $ENV{'PERL_TYPE_TINY_XS'} ? :
101 316 0 if $try_xs
110 316 0 $use_xs ? :
114 6 284 if $INC{'Mouse/Util.pm'}
115 316 0 $try_xs ? :
124 313 3 $strict_mode ? :
134 0 2183 if ($] < "5.01")
146 7198 620 ref $_[0] ? :
156 3 49861 (caller) =~ /^(Moo::HandleMoose|Sub::Quote)/ ? :
224 1 0 $_[2] ? :
226 2 2 (1 xor $_[2]) ? :
241 19 14368 if $self->{'_overload_coderef_no_rebuild'}
249 12336 2032 unless exists $self->{'_overrides_assert_return'}
251 1 14367 if ($self->{'_overrides_assert_return'}) { }
245 14122 elsif (exists &Sub::Quote::quote_sub) { }
262 238 7 $self->can_be_inlined ? :
274 11957 141 $self->can_be_inlined ? :
300 0 95438 @_ == 1 ? :
303 27733 258581 if defined $params{$_}
313 95438 137254 unless ($package =~ /$_TT_GUTS/)
319 12565 82873 if (exists $params{'parent'})
323 12565 0 ref($params{'parent'}) =~ /^Type::Tiny\b/ ? :
327 0 12565 unless &blessed($params{'parent'}) and $params{'parent'}->isa("Type::Tiny")
329 3 12562 if ($params{'parent'}->deprecated and not exists $params{'deprecated'})
334 79 50016 if (exists $params{'constraint'} and defined $params{'constraint'} and not ref $params{'constraint'})
346 1 268 $_ eq '$_' ? :
347 250 19 $type->has_parent ? :
349 79 0 if not exists $params{'parent'} or $params{'parent'}->can_be_inlined
355 82357 13081 unless exists $params{'name'}
358 13053 82385 if ($params{'name'} ne "__ANON__")
363 1 13052 unless $params{'name'} =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/ms or eval " use 5.008; \$params{name} =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm "
366 6 46 if (exists $params{'coercion'} and not ref $params{'coercion'} and $params{'coercion'})
369 0 6 unless $params{'parent'}->has_coercion
375 10 40294 if (not exists $params{'inlined'} and exists $params{'constraint'} and !exists $params{'parent'} || $params{'parent'}->can_be_inlined and $QFS ||= "Sub::Quote"->can("quoted_from_sub"))
380 5 5 unless &$QFS($params{'constraint'})
384 0 28 $var eq '$_' ? :
390 10 18 if $self->has_parent
394 4 6 if $perlstring and not $captures
399 95373 64 unless ($params{'tmp'})
410 3 95434 if (ref $params{'coercion'} eq 'CODE') { }
9 95425 elsif (ref $params{'coercion'} eq 'ARRAY') { }
430 1129 94308 if ($params{'my_methods'})
477 0 4562 unless @_
480 2 4560 if ref $DD eq "CODE"
486 1842 2523 !ref($value) ? :
195 4365 !defined($value) ? :
487 0 2523 defined $DD ? :
497 44 2479 if length $str >= $N
500 0 2523 unless (eval {
510 59524 64 ref $_ ? :
555 776 29353 if $_[0]{'_build_coercion'}
556 18133 11996 if $_[0]{'coercion'}
561 145 552 if $self->{'_build_coercion'}
564 9 543 unless $self->has_coercion and @{$self->coercion->type_coercion_map;}
586 11494 915 unless $self->is_anon
588 369 12040 if ref $self->{'_build_coercion'}
596 30 278 if "$self" eq "__ANON__"
607 35 1057 !ref($_) && /\W/ ? :
0 1092 !defined($_) ? :
616 3515 44488 if ($self->_is_null_constraint and $self->has_parent)
621 4101 40387 if $self->can_be_inlined
627 294 40093 if $self->has_parent
628 40387 0 unless $self->_is_null_constraint
629 0 40387 unless @constraints
634 2507 6273 unless &$c(@_)
642 11363 1114 if $self->has_parent
650 1 0 if ref $_->{'definition_context'}
652 1 0 $found ? :
657 764 3421 if ($self->_is_null_constraint and $self->has_parent)
665 491 144 if (exists $self->{'type_default'})
666 1 490 if (@args)
672 142 2 if (my $parent = $self->parent)
673 85 57 if $self->_is_null_constraint
689 0 1614 unless &blessed($A) and $A->isa("Type::Tiny")
690 0 1614 unless &blessed($B) and $B->isa("Type::Tiny")
693 857 1246 if $result eq ""
694 53 1193 if ($result eq "0E0")
695 12 41 @_ == 3 ? :
762 0 764 unless defined $result
768 0 101 unless defined $result
774 0 19 unless defined $result
780 0 686 unless defined $result
781 364 322 unless $result eq 1 or $result eq 0
786 0 13175 unless &blessed($self) and $self->isa("Type::Tiny")
787 0 13175 unless &blessed($other) and $other->isa("Type::Tiny")
793 0 12635 unless &blessed($self) and $self->isa("Type::Tiny")
794 0 12635 unless &blessed($other) and $other->isa("Type::Tiny")
796 1845 10790 unless $self->has_parent
797 10263 527 unless $self->parent->strictly_equals($other)
803 0 2 unless &blessed($self) and $self->isa("Type::Tiny")
804 0 2 unless &blessed($other) and $other->isa("Type::Tiny")
811 0 2368 unless &blessed($self) and $self->isa("Type::Tiny")
812 0 2368 unless &blessed($other) and $other->isa("Type::Tiny")
814 2368 0 unless $self->strictly_equals($other)
821 14302 24 exists $self->{'library'} && $self->name ne '__ANON__' ? :
831 6299 31076 unless $self->has_parent
843 459 111 if (&$test($_ = $type, $. = $count)) { }
844 1 458 wantarray ? :
870 3954 11457 unless &$c(@_)
879 44 1773 $self->has_message ? :
888 0 3 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
898 2 2136 unless defined $varname
900 450 1688 if $self->check($value)
902 1680 8 if ($self->has_parent)
905 1230 450 if $parent
911 45 413 $varname eq '$_' ? :
917 101 357 if ($self->is_parameterized and $self->parent->has_deep_explanation)
919 101 0 if $deep
935 345 12 if $self->can_be_inlined
942 7 0 if $tmp->can("ambient_pragmas")
956 70 15 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
967 115093 1 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
976 27630 158605 if $self->has_parent and $self->_is_null_constraint
978 13379 145226 if not $self->has_parent and $self->_is_null_constraint
985 0 67234 unless $self->can_be_inlined
988 12110 55124 if $self->has_parent and $self->_is_null_constraint
990 4345 50779 if not $self->has_parent and $self->_is_null_constraint
995 7046 43733 if (@r and not defined $r[0])
996 0 7046 unless $self->has_parent
1001 11114 49861 /[;{}]/ && !/\Ado \{.+\}\z/ ? :
1005 43170 7609 @r == 1 ? :
1016 12202 151 if ($self->can_be_inlined) { }
150 1 elsif ($typevarname) { }
1029 151 12201 if ($typevarname) { }
1054 254 12098 $do_wrapper ? :
1061 365 56 if defined $self and not ref $self
1067 420 1 if ($self) { }
1111 0 7 $seen{$_}++ ? :
1112 0 18 $seen{$_}++ ? :
1113 0 3 $seen{$_}++ ? :
1115 2635 0 defined $_->{'uniq'} ? :
988 41 !ref($_) ? :
3 1029 !defined($_) ? :
3 1032 ref $_ eq 'SCALAR' || ref $_ eq 'REF' ? :
18 1035 ref $_ eq 'HASH' ? :
7 1053 ref $_ eq 'ARRAY' ? :
2635 1060 Types::TypeTiny::is_TypeTiny($_) ? :
1125 0 0 @_ ? :
0 1485 unless $self->is_parameterizable
1136 36 1449 if $key =~ /____CANNOT_KEY____/
1137 379 1106 if defined $key and defined $param_cache{$key}
1145 193 872 if (Types::TypeTiny::is_TypeTiny($constraint)) { }
1154 230 642 if $compiled
1156 862 10 if $self->has_inline_generator
1159 333 539 if exists $self->{'type_default_generator'}
1165 463 409 if ($self->has_coercion_generator)
1170 117 134 if $built
1176 1030 35 if (defined $key)
1181 599 466 unless $self->has_coercion_generator
1194 31 1495 if $self->{'is_object'}
1202 80 10 unless &Scalar::Util::isweak($self->{'complementary_type'})
1214 72 6 if $self->can_be_inlined
1216 2 76 if $self->{'complement_name'}
1231 101 107 if ($self->{'_is_core'}) { }
1249 38 69 if $self->has_library and not $self->is_anon
1250 98 9 if $self->has_parent
1251 94 13 unless $self->_is_null_constraint
1252 12 95 if $self->has_message
1253 70 37 if $self->has_inlined
1258 14 93 if $self->has_coercion
1268 0 3 if $self->has_library and not $self->is_anon
1269 1 2 if $self->has_parent
1270 2 1 unless $self->_is_null_constraint
1271 1 2 if $self->has_message
1277 0 3 if $self->has_coercion
1286 14196 1 unless ($self->is_anon)
1292 0 14197 unless $base_name
1296 13593 604 if $tag eq "types" or not $tag
1302 13594 603 if $tag eq "is" or not $tag
1308 13593 604 if $tag eq "assert" or not $tag
1319 756 13440 $self->has_coercion && $self->coercion->frozen ? :
14196 1 if $tag eq "to" or not $tag
1329 0 604 unless $e->{'tags'}
1331 603 1 if wantarray
1332 0 1 unless @matched == 1
1343 8 100 if (&blessed($next) and $next->isa('Type::Coercion') and $next->is_parameterized) { }
9 91 elsif (&blessed($next) and $next->can('type_coercion_map')) { }
3 88 elsif (ref $next eq 'ARRAY') { }
1403 2 9 if ($c->[$i] == $n)
1409 2 2 if $keep_this
1425 4 3 $self->has_coercion ? :
1431 143 6068 if ($INC{'Moose.pm'} and ref $self and $_[0] =~ /^(?:Class::MOP|MooseX?::Meta)::(.+)$/)
1437 85 58 if $meta eq "TypeConstraint"
1438 54 4 if $meta eq "TypeConstraint::Parameterized"
1439 1 3 if $meta eq "TypeConstraint::Parameterizable"
1440 2 1 if $meta eq "TypeConstraint::Union"
1446 1 348 if ($INC{'Mouse.pm'} and ref $self and $_[0] eq "Mouse::Meta::TypeConstraint")
1464 614 664 if ($self->my_methods->{$name})
1468 662 2 if ($self->has_parent)
1483 0 172 if $_[0] eq "type_parameter" and &blessed($_[0]) and $_[0]->has_parameters
1489 42179 42657 if $can
1491 42656 1 if (ref $self)
1492 443 42213 if ($INC{'Moose.pm'})
1495 10 433 if $method
1497 4 42642 if ($_[0] =~ /\Amy_(.+)\z/)
1499 2 2 if $method
1501 1 42643 if ($self->{'is_object'} and $object_methods{$_[0]})
1506 36 383607 if ($_[0] eq $util)
1508 2 34 unless $self->{'_util'}{$util}
1520 0 689 if $m eq "DESTROY"
1522 689 0 if (ref $self)
1523 3 686 if ($INC{'Moose.pm'})
1525 2 1 if $method
1527 612 75 if ($m =~ /\Amy_(.+)\z/)
1529 612 0 if $method
1531 3 0 if ($self->{'is_object'} and $object_methods{$m})
1538 70 324 if ($m eq $util)
1551 0 45 if ref $self and $_[0] =~ /^ Type::API::Constraint (?: ::Coercible | ::Inlinable )? $/x
1554 0 45 if not ref $self and $_[0] eq "Type::API::Constraint::Constructor"
1556 45 0 'UNIVERSAL'->can('DOES') ? :
1568 16 39 if ($func eq "grep" or $func eq "first" or $func eq "any" or $func eq "all" or $func eq "assert_any" or $func eq "assert_all")
1577 13 30 if ($self->can_be_inlined) { }
1585 5 38 if ($func eq 'grep') { }
5 33 elsif ($func eq 'first') { }
8 25 elsif ($func eq 'any') { }
8 17 elsif ($func eq 'assert_any') { }
9 8 elsif ($func eq 'all') { }
8 0 elsif ($func eq 'assert_all') { }
1611 8 31 if ($func eq "map")
1615 1 3 if ($c->can_be_inlined) { }
1626 29 2 if ($func eq "sort" or $func eq "rsort")
1630 2 27 unless $ptype
1635 6 21 if (ref $sorter eq 'ARRAY') { }
1639 4 2 if ($func eq 'sort') { }
2 0 elsif ($func eq 'rsort') { }
1653 12 9 if ($func eq 'sort') { }
9 0 elsif ($func eq 'rsort') { }
1683 5 0 $_[0]->is_parameterized ? :