Branch Coverage

blib/lib/Type/Tiny.pm
Criterion Covered Total %
branch 369 482 76.5


line true false branch
8 0 310 if ($] < "5.01")
87 0 40155 $_[2] ? :
99 0 308 exists $ENV{'PERL_ONLY'} ? :
2 308 exists $ENV{'PERL_TYPE_TINY_XS'} ? :
102 308 2 if $try_xs
111 308 2 $use_xs ? :
115 0 288 if $INC{'Mouse/Util.pm'}
116 308 2 $try_xs ? :
125 307 3 $strict_mode ? :
135 0 1666 if ($] < "5.01")
147 6594 695 ref $_[0] ? :
157 0 51375 (caller) =~ /^(Moo::HandleMoose|Sub::Quote)/ ? :
225 0 0 $_[2] ? :
227 2 2 if (!0 xor $_[2]) { }
242 19 15207 if $self->{'_overload_coderef_no_rebuild'}
250 12593 2614 unless exists $self->{'_overrides_assert_return'}
252 1 15206 if ($self->{'_overrides_assert_return'}) { }
162 15044 elsif (exists &Sub::Quote::quote_sub) { }
263 155 7 $self->can_be_inlined ? :
275 12350 88 $self->can_be_inlined ? :
301 0 95908 @_ == 1 ? :
304 28509 259215 if defined $params{$_}
314 95908 139284 unless ($package =~ /$_TT_GUTS/)
320 12782 83126 if (exists $params{'parent'})
324 12782 0 ref($params{'parent'}) =~ /^Type::Tiny\b/ ? :
328 0 12782 unless builtin::blessed($params{'parent'}) and $params{'parent'}->isa(__PACKAGE__)
330 3 12779 if ($params{'parent'}->deprecated and not exists $params{'deprecated'})
335 84 50408 if (exists $params{'constraint'} and defined $params{'constraint'} and not ref $params{'constraint'})
347 1 282 $_ eq '$_' ? :
348 264 19 $type->has_parent ? :
350 84 0 if not exists $params{'parent'} or $params{'parent'}->can_be_inlined
356 82593 13315 unless exists $params{'name'}
359 13289 82619 if ($params{'name'} ne "__ANON__")
364 1 13288 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 "
367 2 4 if (exists $params{'coercion'} and not ref $params{'coercion'} and $params{'coercion'})
370 0 2 unless $params{'parent'}->has_coercion
376 6 40186 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"))
381 1 5 unless &$QFS($params{'constraint'})
385 0 28 $var eq '$_' ? :
391 10 18 if $self->has_parent
395 4 2 if $perlstring and not $captures
400 95849 58 unless ($params{'tmp'})
411 2 95905 if (ref $params{'coercion'} eq 'CODE') { }
5 95900 elsif (ref $params{'coercion'} eq 'ARRAY') { }
431 1125 94782 if ($params{'my_methods'})
479 0 2598 unless @_
482 2 2596 if ref $DD eq "CODE"
488 944 1533 !ref($value) ? :
119 2477 if (not defined $value) { }
489 0 1533 defined $DD ? :
500 44 1489 if length $str >= $N
503 0 1533 unless (eval { do { local $SIG{'__WARN__'} = sub { } ; $str = Data::Dumper::Dumper($value); $str = substr($str, 0, ($N - 12)) . '...' . substr($str, -1, 1) if length $str >= $N; 1 } })
513 64860 2 ref $_ ? :
558 718 31282 if $_[0]{'_build_coercion'}
559 19894 12106 if $_[0]{'coercion'}
564 136 511 if $self->{'_build_coercion'}
567 9 502 unless $self->has_coercion and @{$self->coercion->type_coercion_map;}
589 11825 1128 unless $self->is_anon
591 456 12497 if ref $self->{'_build_coercion'}
599 26 166 if "$self" eq "__ANON__"
610 39 1156 !ref($_) && /\W/ ? :
0 1195 !defined($_) ? :
619 3519 44711 if ($self->_is_null_constraint and $self->has_parent)
624 4449 40262 if $self->can_be_inlined
630 210 40052 if $self->has_parent
631 40262 0 unless $self->_is_null_constraint
632 0 40262 unless @constraints
637 1176 4760 unless &$c(@_)
645 11579 1169 if $self->has_parent
653 1 0 if ref $_->{'definition_context'}
655 1 0 $found ? :
660 818 3339 if ($self->_is_null_constraint and $self->has_parent)
668 567 185 if (exists $self->{'type_default'})
669 1 566 if (@args)
675 183 2 if (my $parent = $self->parent)
676 104 79 if $self->_is_null_constraint
692 0 1544 unless builtin::blessed($A) and $A->isa("Type::Tiny")
693 0 1544 unless builtin::blessed($B) and $B->isa("Type::Tiny")
696 860 1185 if $result eq ""
697 51 1134 if ($result eq "0E0")
698 12 39 @_ == 3 ? :
765 0 777 unless defined $result
771 0 101 unless defined $result
777 0 21 unless defined $result
783 0 601 unless defined $result
784 356 245 unless $result eq 1 or $result eq 0
789 0 14433 unless builtin::blessed($self) and $self->isa("Type::Tiny")
790 0 14433 unless builtin::blessed($other) and $other->isa("Type::Tiny")
796 0 13865 unless builtin::blessed($self) and $self->isa("Type::Tiny")
797 0 13865 unless builtin::blessed($other) and $other->isa("Type::Tiny")
799 2038 11827 unless $self->has_parent
800 11274 553 unless $self->parent->strictly_equals($other)
806 0 2 unless builtin::blessed($self) and $self->isa("Type::Tiny")
807 0 2 unless builtin::blessed($other) and $other->isa("Type::Tiny")
814 0 2587 unless builtin::blessed($self) and $self->isa("Type::Tiny")
815 0 2587 unless builtin::blessed($other) and $other->isa("Type::Tiny")
817 2587 0 unless $self->strictly_equals($other)
824 15036 43 if (exists $self->{'library'} and $self->name ne '__ANON__') { }
834 6436 31908 unless $self->has_parent
846 480 111 if (&$test($_ = $type, $. = $count)) { }
847 1 479 wantarray ? :
873 4066 11411 unless &$c(@_)
882 28 893 $self->has_message ? :
891 0 2 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
901 2 2156 unless defined $varname
903 452 1706 if $self->check($value)
905 1698 8 if ($self->has_parent)
908 1246 452 if $parent
914 44 416 $varname eq '$_' ? :
920 102 358 if ($self->is_parameterized and $self->parent->has_deep_explanation)
922 102 0 if $deep
938 346 12 if $self->can_be_inlined
945 7 0 if $tmp->can("ambient_pragmas")
959 72 15 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
970 115082 1 if ($self->{'compiled_type_constraint'} ||= $self->_build_compiled_check)->(@_)
979 28101 162115 if $self->has_parent and $self->_is_null_constraint
981 13565 148550 if not $self->has_parent and $self->_is_null_constraint
988 0 69887 unless $self->can_be_inlined
991 12472 57415 if $self->has_parent and $self->_is_null_constraint
993 4440 52975 if not $self->has_parent and $self->_is_null_constraint
998 7959 45016 if (@r and not defined $r[0])
999 0 7959 unless $self->has_parent
1004 10701 30265 /[;{}]/ && !/\Ado \{.+\}\z/ ? :
23639 40966 if (/\A(?:[A-Z](?:\w)*::[A-Z](?:\w|::)*)\(\$\w+(?:\[\d+\]|\{[^}]+\})?\)\z/i) { }
1008 44328 8647 @r == 1 ? :
1019 12650 98 if ($self->can_be_inlined) { }
97 1 elsif ($typevarname) { }
1032 98 12649 if ($typevarname) { }
1057 309 12438 $do_wrapper ? :
1064 382 56 if defined $self and not ref $self
1070 437 1 if ($self) { }
1096 4 0 if ($self->has_coercion) { }
1100 0 0 $self->check(@_) ? :
1124 0 7 $seen{$_}++ ? :
1125 0 18 $seen{$_}++ ? :
1126 0 3 $seen{$_}++ ? :
1128 3063 0 defined $_->{'uniq'} ? :
4762 42 !ref($_) ? :
3 4804 !defined($_) ? :
6 9613 ref $_ eq 'SCALAR' || ref $_ eq 'REF' ? :
36 9619 ref $_ eq 'HASH' ? :
14 9655 ref $_ eq 'ARRAY' ? :
3063 4835 if (Types::TypeTiny::is_TypeTiny($_)) { }
14 9655 elsif (ref $_ eq 'ARRAY') { }
36 9619 elsif (ref $_ eq 'HASH') { }
6 9613 elsif (ref $_ eq 'SCALAR' or ref $_ eq 'REF') { }
1138 0 0 @_ ? :
0 1781 unless $self->is_parameterizable
1149 37 1744 if $key =~ /____CANNOT_KEY____/
1150 418 1363 if defined $key and defined $param_cache{$key}
1158 441 879 if (Types::TypeTiny::is_TypeTiny($constraint)) { }
1167 224 655 if $compiled
1169 869 10 if $self->has_inline_generator
1172 319 560 if exists $self->{'type_default_generator'}
1178 465 414 if ($self->has_coercion_generator)
1183 111 107 if $built
1189 1284 36 if (defined $key)
1194 852 468 unless $self->has_coercion_generator
1202 931 0 if ref $args
1204 2 929 if (defined $max_args and $args > $max_args or defined $min_args and $args < $min_args)
1206 2 0 defined $min_args ? :
2 0 defined $max_args ? :
1224 27 1497 if $self->{'is_object'}
1232 71 10 unless builtin::is_weak($self->{'complementary_type'})
1244 63 6 if $self->can_be_inlined
1246 2 67 if $self->{'complement_name'}
1261 0 0 if ($self->{'_is_core'}) { }
1279 0 0 if $self->has_library and not $self->is_anon
1280 0 0 if $self->has_parent
1281 0 0 unless $self->_is_null_constraint
1282 0 0 if $self->has_message
1283 0 0 if $self->has_inlined
1288 0 0 if $self->has_coercion
1298 0 0 if $self->has_library and not $self->is_anon
1299 0 0 if $self->has_parent
1300 0 0 unless $self->_is_null_constraint
1301 0 0 if $self->has_message
1307 0 0 if $self->has_coercion
1316 15169 1 unless ($self->is_anon)
1322 0 15170 unless $base_name
1326 14385 785 if $tag eq "types" or not $tag
1332 14386 784 if $tag eq "is" or not $tag
1338 14385 785 if $tag eq "assert" or not $tag
1349 1033 14136 $self->has_coercion && $self->coercion->frozen ? :
15169 1 if $tag eq "to" or not $tag
1359 0 785 unless $e->{'tags'}
1361 784 1 if wantarray
1362 0 1 unless @matched == 1
1373 7 90 if (builtin::blessed($next) and $next->isa('Type::Coercion') and $next->is_parameterized) { }
9 81 elsif (builtin::blessed($next) and $next->can('type_coercion_map')) { }
0 81 elsif (ref $next eq 'ARRAY') { }
1433 2 9 if ($c->[$i] == $n)
1439 2 2 if $keep_this
1455 4 12 $self->has_coercion ? :
1461 0 0 if ($INC{'Moose/Meta/TypeConstraint.pm'} and ref $self and $_[0] =~ /^(?:Class::MOP|MooseX?::Meta)::(.+)$/)
1467 0 0 if $meta eq "TypeConstraint"
1468 0 0 if $meta eq "TypeConstraint::Parameterized"
1469 0 0 if $meta eq "TypeConstraint::Parameterizable"
1470 0 0 if $meta eq "TypeConstraint::Union"
1476 0 0 if ($INC{'Mouse.pm'} and ref $self and $_[0] eq "Mouse::Meta::TypeConstraint")
1494 640 690 if ($self->my_methods->{$name})
1498 688 2 if ($self->has_parent)
1515 0 1 if $_[0] eq "type_parameter" and builtin::blessed($_[0]) and $_[0]->has_parameters
1521 40839 42361 if $can
1523 42360 1 if (ref $self)
1524 4 42356 if ($_[0] =~ /\Amy_(.+)\z/)
1526 2 2 if $method
1528 1 42357 if ($self->{'is_object'} and $object_methods{$_[0]})
1532 36 42321 if ($_[0] =~ /$re_list_methods/)
1535 2 34 unless $self->{'_util'}{$util}
1538 0 42321 if ($INC{'Moose/Meta/TypeConstraint.pm'})
1541 0 0 if $method
1551 0 1859 if $m eq "DESTROY"
1553 1859 0 if (ref $self)
1554 638 1221 if ($m =~ /\Amy_(.+)\z/)
1556 638 0 if $method
1558 3 0 if ($self->{'is_object'} and $object_methods{$m})
1564 1217 1 if ($m =~ /$re_list_methods/)
1567 0 1 if ($INC{'Moose/Meta/TypeConstraint.pm'})
1569 0 0 if $method
1580 0 45 if ref $self and $_[0] =~ /^ Type::API::Constraint (?: ::Coercible | ::Inlinable )? $/x
1583 0 45 if not ref $self and $_[0] eq "Type::API::Constraint::Constructor"
1585 45 0 'UNIVERSAL'->can('DOES') ? :
1597 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")
1606 149 30 if ($self->can_be_inlined) { }
1614 10 169 if ($func eq 'grep') { }
5 164 elsif ($func eq 'first') { }
8 156 elsif ($func eq 'any') { }
8 148 elsif ($func eq 'assert_any') { }
140 8 elsif ($func eq 'all') { }
8 0 elsif ($func eq 'assert_all') { }
1640 8 31 if ($func eq "map")
1644 1 3 if ($c->can_be_inlined) { }
1655 29 2 if ($func eq "sort" or $func eq "rsort")
1659 2 27 unless $ptype
1664 6 21 if (ref $sorter eq 'ARRAY') { }
1668 4 2 if ($func eq 'sort') { }
2 0 elsif ($func eq 'rsort') { }
1682 12 9 if ($func eq 'sort') { }
9 0 elsif ($func eq 'rsort') { }
1712 5 0 $_[0]->is_parameterized ? :