Branch Coverage

blib/lib/Type/Tiny.pm
Criterion Covered Total %
branch 348 460 75.6


line true false branch
8 0 272 if ($] < "5.01")
86 0 40153 $_[2] ? :
98 0 272 exists $ENV{'PERL_ONLY'} ? :
0 272 exists $ENV{'PERL_TYPE_TINY_XS'} ? :
101 272 0 if $try_xs
110 272 0 $use_xs ? :
114 0 249 if $INC{'Mouse/Util.pm'}
115 272 0 $try_xs ? :
124 269 3 $strict_mode ? :
134 0 1720 if ($] < "5.01")
146 5895 519 ref $_[0] ? :
156 0 42838 (caller) =~ /^(Moo::HandleMoose|Sub::Quote)/ ? :
224 0 0 $_[2] ? :
226 2 2 (1 xor $_[2]) ? :
241 19 12046 if $self->{'_overload_coderef_no_rebuild'}
249 10462 1584 unless exists $self->{'_overrides_assert_return'}
251 1 12045 if ($self->{'_overrides_assert_return'}) { }
162 11883 elsif (exists &Sub::Quote::quote_sub) { }
262 155 7 $self->can_be_inlined ? :
274 10219 88 $self->can_be_inlined ? :
300 0 92981 @_ == 1 ? :
303 23332 255611 if defined $params{$_}
313 92981 134834 unless ($package =~ /$_TT_GUTS/)
319 10710 82271 if (exists $params{'parent'})
323 10710 0 ref($params{'parent'}) =~ /^Type::Tiny\b/ ? :
327 0 10710 unless &blessed($params{'parent'}) and $params{'parent'}->isa("Type::Tiny")
329 3 10707 if ($params{'parent'}->deprecated and not exists $params{'deprecated'})
334 77 48368 if (exists $params{'constraint'} and defined $params{'constraint'} and not ref $params{'constraint'})
346 1 263 $_ eq '$_' ? :
347 245 19 $type->has_parent ? :
349 77 0 if not exists $params{'parent'} or $params{'parent'}->can_be_inlined
355 81986 10995 unless exists $params{'name'}
358 10971 82010 if ($params{'name'} ne "__ANON__")
363 1 10970 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 0 if (exists $params{'coercion'} and not ref $params{'coercion'} and $params{'coercion'})
369 0 2 unless $params{'parent'}->has_coercion
375 6 40164 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 92922 58 unless ($params{'tmp'})
410 2 92978 if (ref $params{'coercion'} eq 'CODE') { }
5 92973 elsif (ref $params{'coercion'} eq 'ARRAY') { }
430 965 92015 if ($params{'my_methods'})
477 0 2415 unless @_
480 2 2413 if ref $DD eq "CODE"
486 812 1494 !ref($value) ? :
107 2306 !defined($value) ? :
487 0 1494 defined $DD ? :
497 32 1462 if length $str >= $N
500 0 1494 unless (eval { do { $str = Data::Dumper::Dumper($value); $str = substr($str, 0, $N - 12) . "..." . substr($str, -1, 1) if length $str >= $N; 1 } })
510 58084 2 ref $_ ? :
554 598 24766 if $_[0]{'_build_coercion'}
555 15268 10096 if $_[0]{'coercion'}
560 130 506 if $self->{'_build_coercion'}
563 9 497 unless $self->has_coercion and @{$self->coercion->type_coercion_map;}
585 9827 809 unless $self->is_anon
587 291 10345 if ref $self->{'_build_coercion'}
595 23 152 if "$self" eq "__ANON__"
606 35 976 !ref($_) && /\W/ ? :
0 1011 !defined($_) ? :
615 2986 43820 if ($self->_is_null_constraint and $self->has_parent)
620 3562 40258 if $self->can_be_inlined
626 207 40051 if $self->has_parent
627 40258 0 unless $self->_is_null_constraint
628 0 40258 unless @constraints
633 1168 4746 unless &$c(@_)
642 1 0 if ref $_->{'definition_context'}
644 1 0 $found ? :
649 716 2955 if ($self->_is_null_constraint and $self->has_parent)
657 412 142 if (exists $self->{'type_default'})
658 1 411 if (@args)
664 140 2 if (my $parent = $self->parent)
665 83 57 if $self->_is_null_constraint
681 0 1455 unless &blessed($A) and $A->isa("Type::Tiny")
682 0 1455 unless &blessed($B) and $B->isa("Type::Tiny")
685 701 1143 if $result eq ""
686 51 1092 if ($result eq "0E0")
687 12 39 @_ == 3 ? :
754 0 761 unless defined $result
760 0 101 unless defined $result
766 0 19 unless defined $result
772 0 530 unless defined $result
773 307 223 unless $result eq 1 or $result eq 0
778 0 12903 unless &blessed($self) and $self->isa("Type::Tiny")
779 0 12903 unless &blessed($other) and $other->isa("Type::Tiny")
785 0 12363 unless &blessed($self) and $self->isa("Type::Tiny")
786 0 12363 unless &blessed($other) and $other->isa("Type::Tiny")
788 1797 10566 unless $self->has_parent
789 10039 527 unless $self->parent->strictly_equals($other)
795 0 2 unless &blessed($self) and $self->isa("Type::Tiny")
796 0 2 unless &blessed($other) and $other->isa("Type::Tiny")
803 0 2320 unless &blessed($self) and $self->isa("Type::Tiny")
804 0 2320 unless &blessed($other) and $other->isa("Type::Tiny")
806 2320 0 unless $self->strictly_equals($other)
813 11989 19 exists $self->{'library'} && $self->name ne '__ANON__' ? :
823 5756 28647 unless $self->has_parent
835 459 111 if (&$test($_ = $type, $. = $count)) { }
836 1 458 wantarray ? :
862 3694 10091 unless &$c(@_)
871 28 860 $self->has_message ? :
880 0 2 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
890 2 2128 unless defined $varname
892 446 1684 if $self->check($value)
894 1676 8 if ($self->has_parent)
897 1230 446 if $parent
903 41 413 $varname eq '$_' ? :
909 101 353 if ($self->is_parameterized and $self->parent->has_deep_explanation)
911 101 0 if $deep
927 341 12 if $self->can_be_inlined
934 7 0 if $tmp->can("ambient_pragmas")
948 68 13 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
959 115082 1 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
968 24587 144772 if $self->has_parent and $self->_is_null_constraint
970 11746 133026 if not $self->has_parent and $self->_is_null_constraint
977 0 60278 unless $self->can_be_inlined
980 11036 49242 if $self->has_parent and $self->_is_null_constraint
982 3868 45374 if not $self->has_parent and $self->_is_null_constraint
987 6563 38811 if (@r and not defined $r[0])
988 0 6563 unless $self->has_parent
993 9836 45106 /[;{}]/ && !/\Ado \{.+\}\z/ ? :
997 38281 7093 @r == 1 ? :
1006 10376 98 if ($self->can_be_inlined) { }
97 1 elsif ($typevarname) { }
1019 98 10375 if ($typevarname) { }
1044 166 10307 $do_wrapper ? :
1053 360 54 if defined $self and not ref $self
1059 413 1 if ($self) { }
1103 0 7 $seen{$_}++ ? :
1104 0 18 $seen{$_}++ ? :
1105 0 3 $seen{$_}++ ? :
1107 2395 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' ? :
2395 1045 Types::TypeTiny::is_TypeTiny($_) ? :
1117 0 0 @_ ? :
0 1362 unless $self->is_parameterizable
1128 34 1328 if $key =~ /____CANNOT_KEY____/
1129 362 1000 if defined $key and defined $param_cache{$key}
1137 168 791 if (Types::TypeTiny::is_TypeTiny($constraint)) { }
1146 170 621 if $compiled
1148 781 10 if $self->has_inline_generator
1151 256 535 if exists $self->{'type_default_generator'}
1157 384 407 if ($self->has_coercion_generator)
1162 111 79 if $built
1168 926 33 if (defined $key)
1173 572 387 unless $self->has_coercion_generator
1186 27 1274 if $self->{'is_object'}
1194 66 10 unless &Scalar::Util::isweak($self->{'complementary_type'})
1206 58 6 if $self->can_be_inlined
1208 2 62 if $self->{'complement_name'}
1223 0 0 if ($self->{'_is_core'}) { }
1241 0 0 if $self->has_library and not $self->is_anon
1242 0 0 if $self->has_parent
1243 0 0 unless $self->_is_null_constraint
1244 0 0 if $self->has_message
1245 0 0 if $self->has_inlined
1250 0 0 if $self->has_coercion
1260 0 0 if $self->has_library and not $self->is_anon
1261 0 0 if $self->has_parent
1262 0 0 unless $self->_is_null_constraint
1263 0 0 if $self->has_message
1269 0 0 if $self->has_coercion
1278 11923 1 unless ($self->is_anon)
1284 0 11924 unless $base_name
1288 11403 521 if $tag eq "types" or not $tag
1294 11404 520 if $tag eq "is" or not $tag
1300 11403 521 if $tag eq "assert" or not $tag
1311 641 11282 $self->has_coercion && $self->coercion->frozen ? :
11923 1 if $tag eq "to" or not $tag
1321 0 521 unless $e->{'tags'}
1323 520 1 if wantarray
1324 0 1 unless @matched == 1
1335 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') { }
1395 2 9 if ($c->[$i] == $n)
1401 2 2 if $keep_this
1417 4 3 $self->has_coercion ? :
1423 0 0 if ($INC{'Moose.pm'} and ref $self and $_[0] =~ /^(?:Class::MOP|MooseX?::Meta)::(.+)$/)
1429 0 0 if $meta eq "TypeConstraint"
1430 0 0 if $meta eq "TypeConstraint::Parameterized"
1431 0 0 if $meta eq "TypeConstraint::Parameterizable"
1432 0 0 if $meta eq "TypeConstraint::Union"
1438 0 0 if ($INC{'Mouse.pm'} and ref $self and $_[0] eq "Mouse::Meta::TypeConstraint")
1456 614 664 if ($self->my_methods->{$name})
1460 662 2 if ($self->has_parent)
1475 0 1 if $_[0] eq "type_parameter" and &blessed($_[0]) and $_[0]->has_parameters
1481 35755 42080 if $can
1483 42079 1 if (ref $self)
1484 0 42079 if ($INC{'Moose.pm'})
1487 0 0 if $method
1489 4 42075 if ($_[0] =~ /\Amy_(.+)\z/)
1491 2 2 if $method
1493 1 42076 if ($self->{'is_object'} and $object_methods{$_[0]})
1498 36 378504 if ($_[0] eq $util)
1500 2 34 unless $self->{'_util'}{$util}
1512 0 685 if $m eq "DESTROY"
1514 685 0 if (ref $self)
1515 0 685 if ($INC{'Moose.pm'})
1517 0 0 if $method
1519 612 73 if ($m =~ /\Amy_(.+)\z/)
1521 612 0 if $method
1523 3 0 if ($self->{'is_object'} and $object_methods{$m})
1530 70 306 if ($m eq $util)
1543 0 45 if ref $self and $_[0] =~ /^ Type::API::Constraint (?: ::Coercible | ::Inlinable )? $/x
1546 0 45 if not ref $self and $_[0] eq "Type::API::Constraint::Constructor"
1548 45 0 'UNIVERSAL'->can('DOES') ? :
1560 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")
1569 13 30 if ($self->can_be_inlined) { }
1577 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') { }
1603 8 31 if ($func eq "map")
1607 1 3 if ($c->can_be_inlined) { }
1618 29 2 if ($func eq "sort" or $func eq "rsort")
1622 2 27 unless $ptype
1627 6 21 if (ref $sorter eq 'ARRAY') { }
1631 4 2 if ($func eq 'sort') { }
2 0 elsif ($func eq 'rsort') { }
1645 12 9 if ($func eq 'sort') { }
9 0 elsif ($func eq 'rsort') { }
1675 5 0 $_[0]->is_parameterized ? :