Branch Coverage

blib/lib/Type/Tiny.pm
Criterion Covered Total %
branch 351 462 75.9


line true false branch
8 0 279 if ($] < "5.01")
86 0 40153 $_[2] ? :
98 0 279 exists $ENV{'PERL_ONLY'} ? :
0 279 exists $ENV{'PERL_TYPE_TINY_XS'} ? :
101 279 0 if $try_xs
110 279 0 $use_xs ? :
114 0 261 if $INC{'Mouse/Util.pm'}
115 279 0 $try_xs ? :
124 276 3 $strict_mode ? :
134 0 1942 if ($] < "5.01")
146 6379 542 ref $_[0] ? :
156 0 44966 (caller) =~ /^(Moo::HandleMoose|Sub::Quote)/ ? :
224 0 0 $_[2] ? :
226 2 2 (1 xor $_[2]) ? :
241 19 12826 if $self->{'_overload_coderef_no_rebuild'}
249 11045 1781 unless exists $self->{'_overrides_assert_return'}
251 1 12825 if ($self->{'_overrides_assert_return'}) { }
162 12663 elsif (exists &Sub::Quote::quote_sub) { }
262 155 7 $self->can_be_inlined ? :
274 10802 88 $self->can_be_inlined ? :
300 0 93746 @_ == 1 ? :
303 24764 256474 if defined $params{$_}
313 93746 135455 unless ($package =~ /$_TT_GUTS/)
319 11257 82489 if (exists $params{'parent'})
323 11257 0 ref($params{'parent'}) =~ /^Type::Tiny\b/ ? :
327 0 11257 unless &blessed($params{'parent'}) and $params{'parent'}->isa("Type::Tiny")
329 3 11254 if ($params{'parent'}->deprecated and not exists $params{'deprecated'})
334 79 48921 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 82055 11691 unless exists $params{'name'}
358 11667 82079 if ($params{'name'} ne "__ANON__")
363 1 11666 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 2 4 if (exists $params{'coercion'} and not ref $params{'coercion'} and $params{'coercion'})
369 0 2 unless $params{'parent'}->has_coercion
375 6 40182 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 1 5 unless &$QFS($params{'constraint'})
384 0 28 $var eq '$_' ? :
390 10 18 if $self->has_parent
394 4 2 if $perlstring and not $captures
399 93687 58 unless ($params{'tmp'})
410 2 93743 if (ref $params{'coercion'} eq 'CODE') { }
5 93738 elsif (ref $params{'coercion'} eq 'ARRAY') { }
430 1013 92732 if ($params{'my_methods'})
477 0 2517 unless @_
480 2 2515 if ref $DD eq "CODE"
486 910 1497 !ref($value) ? :
108 2407 !defined($value) ? :
487 0 1497 defined $DD ? :
497 33 1464 if length $str >= $N
500 0 1497 unless (eval { do { $str = Data::Dumper::Dumper($value); $str = substr($str, 0, $N - 12) . "..." . substr($str, -1, 1) if length $str >= $N; 1 } })
510 58718 2 ref $_ ? :
555 623 26335 if $_[0]{'_build_coercion'}
556 16292 10666 if $_[0]{'coercion'}
561 136 503 if $self->{'_build_coercion'}
564 9 494 unless $self->has_coercion and @{$self->coercion->type_coercion_map;}
586 10399 817 unless $self->is_anon
588 306 10910 if ref $self->{'_build_coercion'}
596 25 153 if "$self" eq "__ANON__"
607 35 979 !ref($_) && /\W/ ? :
0 1014 !defined($_) ? :
616 3134 44023 if ($self->_is_null_constraint and $self->has_parent)
621 3765 40258 if $self->can_be_inlined
627 207 40051 if $self->has_parent
628 40258 0 unless $self->_is_null_constraint
629 0 40258 unless @constraints
634 1168 4742 unless &$c(@_)
642 10206 947 if $self->has_parent
650 1 0 if ref $_->{'definition_context'}
652 1 0 $found ? :
657 736 3033 if ($self->_is_null_constraint and $self->has_parent)
665 417 142 if (exists $self->{'type_default'})
666 1 416 if (@args)
672 140 2 if (my $parent = $self->parent)
673 83 57 if $self->_is_null_constraint
689 0 1477 unless &blessed($A) and $A->isa("Type::Tiny")
690 0 1477 unless &blessed($B) and $B->isa("Type::Tiny")
693 732 1152 if $result eq ""
694 51 1101 if ($result eq "0E0")
695 12 39 @_ == 3 ? :
762 0 761 unless defined $result
768 0 101 unless defined $result
774 0 19 unless defined $result
780 0 552 unless defined $result
781 321 231 unless $result eq 1 or $result eq 0
786 0 13040 unless &blessed($self) and $self->isa("Type::Tiny")
787 0 13040 unless &blessed($other) and $other->isa("Type::Tiny")
793 0 12500 unless &blessed($self) and $self->isa("Type::Tiny")
794 0 12500 unless &blessed($other) and $other->isa("Type::Tiny")
796 1818 10682 unless $self->has_parent
797 10155 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 2341 unless &blessed($self) and $self->isa("Type::Tiny")
812 0 2341 unless &blessed($other) and $other->isa("Type::Tiny")
814 2341 0 unless $self->strictly_equals($other)
821 12765 24 exists $self->{'library'} && $self->name ne '__ANON__' ? :
831 6052 30205 unless $self->has_parent
843 459 111 if (&$test($_ = $type, $. = $count)) { }
844 1 458 wantarray ? :
870 3865 10907 unless &$c(@_)
879 28 863 $self->has_message ? :
888 0 2 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
898 2 2128 unless defined $varname
900 446 1684 if $self->check($value)
902 1676 8 if ($self->has_parent)
905 1230 446 if $parent
911 41 413 $varname eq '$_' ? :
917 101 353 if ($self->is_parameterized and $self->parent->has_deep_explanation)
919 101 0 if $deep
935 341 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 115082 1 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
976 25602 149708 if $self->has_parent and $self->_is_null_constraint
978 12281 137427 if not $self->has_parent and $self->_is_null_constraint
985 0 63193 unless $self->can_be_inlined
988 11457 51736 if $self->has_parent and $self->_is_null_constraint
990 4037 47699 if not $self->has_parent and $self->_is_null_constraint
995 6988 40711 if (@r and not defined $r[0])
996 0 6988 unless $self->has_parent
1001 10433 47404 /[;{}]/ && !/\Ado \{.+\}\z/ ? :
1005 40148 7551 @r == 1 ? :
1016 10960 98 if ($self->can_be_inlined) { }
97 1 elsif ($typevarname) { }
1029 98 10959 if ($typevarname) { }
1054 167 10890 $do_wrapper ? :
1061 361 56 if defined $self and not ref $self
1067 416 1 if ($self) { }
1111 0 7 $seen{$_}++ ? :
1112 0 18 $seen{$_}++ ? :
1113 0 3 $seen{$_}++ ? :
1115 2404 0 defined $_->{'uniq'} ? :
975 39 !ref($_) ? :
3 1014 !defined($_) ? :
3 1017 ref $_ eq 'SCALAR' || ref $_ eq 'REF' ? :
18 1020 ref $_ eq 'HASH' ? :
7 1038 ref $_ eq 'ARRAY' ? :
2404 1045 Types::TypeTiny::is_TypeTiny($_) ? :
1125 0 0 @_ ? :
0 1366 unless $self->is_parameterizable
1136 34 1332 if $key =~ /____CANNOT_KEY____/
1137 362 1004 if defined $key and defined $param_cache{$key}
1145 168 795 if (Types::TypeTiny::is_TypeTiny($constraint)) { }
1154 173 622 if $compiled
1156 785 10 if $self->has_inline_generator
1159 259 536 if exists $self->{'type_default_generator'}
1165 388 407 if ($self->has_coercion_generator)
1170 111 80 if $built
1176 930 33 if (defined $key)
1181 572 391 unless $self->has_coercion_generator
1194 27 1280 if $self->{'is_object'}
1202 66 10 unless &Scalar::Util::isweak($self->{'complementary_type'})
1214 58 6 if $self->can_be_inlined
1216 2 62 if $self->{'complement_name'}
1231 0 0 if ($self->{'_is_core'}) { }
1249 0 0 if $self->has_library and not $self->is_anon
1250 0 0 if $self->has_parent
1251 0 0 unless $self->_is_null_constraint
1252 0 0 if $self->has_message
1253 0 0 if $self->has_inlined
1258 0 0 if $self->has_coercion
1268 0 0 if $self->has_library and not $self->is_anon
1269 0 0 if $self->has_parent
1270 0 0 unless $self->_is_null_constraint
1271 0 0 if $self->has_message
1277 0 0 if $self->has_coercion
1286 12734 1 unless ($self->is_anon)
1292 0 12735 unless $base_name
1296 12160 575 if $tag eq "types" or not $tag
1302 12161 574 if $tag eq "is" or not $tag
1308 12160 575 if $tag eq "assert" or not $tag
1319 719 12015 $self->has_coercion && $self->coercion->frozen ? :
12734 1 if $tag eq "to" or not $tag
1329 0 575 unless $e->{'tags'}
1331 574 1 if wantarray
1332 0 1 unless @matched == 1
1343 7 89 if (&blessed($next) and $next->isa('Type::Coercion') and $next->is_parameterized) { }
9 80 elsif (&blessed($next) and $next->can('type_coercion_map')) { }
0 80 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 0 0 if ($INC{'Moose.pm'} and ref $self and $_[0] =~ /^(?:Class::MOP|MooseX?::Meta)::(.+)$/)
1437 0 0 if $meta eq "TypeConstraint"
1438 0 0 if $meta eq "TypeConstraint::Parameterized"
1439 0 0 if $meta eq "TypeConstraint::Parameterizable"
1440 0 0 if $meta eq "TypeConstraint::Union"
1446 0 0 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 1 if $_[0] eq "type_parameter" and &blessed($_[0]) and $_[0]->has_parameters
1489 37763 42157 if $can
1491 42156 1 if (ref $self)
1492 0 42156 if ($INC{'Moose.pm'})
1495 0 0 if $method
1497 4 42152 if ($_[0] =~ /\Amy_(.+)\z/)
1499 2 2 if $method
1501 1 42153 if ($self->{'is_object'} and $object_methods{$_[0]})
1506 36 379197 if ($_[0] eq $util)
1508 2 34 unless $self->{'_util'}{$util}
1520 0 686 if $m eq "DESTROY"
1522 686 0 if (ref $self)
1523 0 686 if ($INC{'Moose.pm'})
1525 0 0 if $method
1527 612 74 if ($m =~ /\Amy_(.+)\z/)
1529 612 0 if $method
1531 3 0 if ($self->{'is_object'} and $object_methods{$m})
1538 70 315 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 ? :