Branch Coverage

blib/lib/Zydeco.pm
Criterion Covered Total %
branch 316 502 62.9


line true false branch
42 4 83 if $kind =~ /role_generator/u
46 4 79 if ($kind =~ /class_generator/u) { }
60 125 212 if ($action eq '-gather') { }
38 174 elsif ($action eq '-go') { }
87 87 elsif ($action eq '-parent') { }
87 0 elsif ($action eq '-unparent') { }
63 87 304 if (my($kind, $pkg) = $k =~ /^(class|role|class_generator|role_generator):(.+)$/u) { }
64 0 87 unless $stack{$me}{$caller}
87 0 if (my(@stack) = @{[] unless $stack{$me}{$caller};})
65 87 0 if $stack[-1] eq $pkg
66 25 62 if (@stack)
80 0 38 if ($gather{$me}{$caller}{'_defer_role'})
84 0 38 if ($gather{$me}{$caller}{'_defer_role_generator'})
88 1 37 if ($gather{$me}{$caller}{'_defer_class_generator'})
91 5 33 if ($gather{$me}{$caller}{'_defer_class'})
95 0 35 if ($gather{$me}{$caller}{'debug'})
116 3 2 unless $classes
124 7 17 if $spec->{'_depth'} > $max_depth
128 60 24 unless $spec->{'_depth'} == $depth
131 3 21 unless ($class_hash{$parent_key})
749 0 143 unless "$GRAMMAR" =~ m[<$name>(.+)</$name>]su
753 438 2156 if (my($named_capture) = /# CAPTURE:(\w+)/u)
760 0 39 $opts{'anchor'} eq 'both' ? :
0 39 $opts{'anchor'} eq 'end' ? :
104 39 $opts{'anchor'} eq 'start' ? :
776 5 39 unless $sig
784 0 62 unless $sig
788 5 57 if ($sig =~ /^((?&PerlBlock)) $GRAMMAR/osux) { }
48 9 elsif ($sig =~ /^((?&MxpTypeSpec)) $GRAMMAR/osux) { }
797 1 47 $type =~ /#/u ? :
807 14 48 if ($sig =~ /^\*((?&PerlIdentifier)) $GRAMMAR/osux) { }
1 47 elsif ($sig =~ /^ ( [\$\@\%] ) (?: [=),?] | (?&PerlNWS) | $ ) $GRAMMAR/osux) { }
47 0 elsif ($sig =~ /^((?&MxpSignatureVariable)) $GRAMMAR/osux) { }
835 5 57 if ($sig =~ /^\?/u) { }
2 55 elsif ($sig =~ /^=((?&PerlOWS))((?&PerlScalarExpression)) $GRAMMAR/osux) { }
846 0 2 if ($default =~ / \$ (?: class|self) /osux)
853 23 39 if ($sig)
854 23 0 if ($sig =~ /^,/u) { }
868 2 37 if ($seen_named and $seen_pos)
875 0 2 if (grep $_->{'positional'}, @parsed)
882 0 6 if ($is_optional) { }
0 6 elsif ($p->{'default'}) { }
0 6 elsif ($p->{'name'} =~ /^[\@\%]/u) { }
902 14 42 if $seen_named
903 3 53 if ($p->{'name'} =~ /^[\@\%]/u) { }
904 0 3 if (@parsed)
915 2 1 if ($p->{'type'} eq 'Any')
916 1 1 substr($p->{'name'}, 0, 1) eq '%' ? :
923 3 53 if ($p->{'type_is_block'}) { }
929 5 46 if (exists $p->{'optional'} or exists $p->{'default'} or $p->{'slurpy'})
931 5 5 if exists $p->{'optional'}
932 2 8 if exists $p->{'default'}
933 3 7 if exists $p->{'slurpy'}
938 7 32 if $seen_named
941 2 37 if (@head or @tail)
944 2 2 $_->{'type_is_block'} ? :
945 0 2 $_->{'type_is_block'} ? :
946 2 0 $head_stuff ? :
2 0 $tail_stuff ? :
974 3 31 if ($rolelist =~ /^((?&PerlBlock)) $GRAMMAR/osux) { }
31 0 elsif ($rolelist =~ /^((?&PerlQualifiedIdentifier)) $GRAMMAR/osux) { }
990 8 26 if ($rolelist =~ /^\?/sux) { }
6 20 elsif ($rolelist =~ /^((?&PerlOWS)(?&PerlList)(?&PerlOWS)) $GRAMMAR/osux) { }
991 0 8 if ($kind eq 'class')
1004 3 31 if ($role_is_block) { }
1010 6 28 if ($role_params)
1015 5 29 if (length $rolelist)
1016 5 0 if ($rolelist =~ /^,/u) { }
1030 0 49 unless $_[1]
1036 0 36 unless $names
1062 2 1 $has_sig ? :
1066 0 0 if $attr =~ /^:optimize\b/u
1069 0 3 if (defined $code and $code =~ /^=(.+)$/su)
1074 1 2 if ($via)
1075 0 1 $name =~ /^\{/u ? :
0 1 $via =~ /^\{/u ? :
1082 0 2 unless ($has_sig)
1084 0 0 $name =~ /^\{/u ? :
0 0 $optim ? :
1095 0 2 $name =~ /^\{/u ? :
0 2 $optim ? :
1112 19 13 $has_sig ? :
1116 3 1 if $attr =~ /^:optimize\b/u
1119 0 32 if (defined $code and $code =~ /^=(.+)$/su)
1125 1 31 if (defined $name and $name =~ /^\$(.+)$/u)
1130 1 31 if ($code =~ /\$\s*factory/u)
1135 7 25 if ($kind eq 'symmethod')
1141 30 2 if (defined $name and not defined $lex_name) { }
1142 17 13 if ($has_sig) { }
1144 0 17 $name =~ /^\{/u ? :
2 15 $optim ? :
1159 0 13 $name =~ /^\{/u ? :
0 13 $optim ? :
1172 0 2 if $kind eq 'symmethod'
1174 2 0 if ($has_sig) { }
1176 1 1 $optim ? :
1189 0 0 $optim ? :
1200 1 31 if ($lex_name)
1211 12 0 $has_sig ? :
1216 0 1 if $attr =~ /^:optimize\b/u
1217 1 0 if (my($alias) = $attr =~ /^:alias\((.+)\)$/u)
1222 4 8 if (defined $code and $code =~ /^=(.+)$/su)
1229 12 0 if ($has_sig) { }
1230 2 10 $kind eq 'factory' ? :
1239 0 12 $name =~ /^\{/u ? :
1253 0 0 $kind eq 'factory' ? :
1260 0 0 $name =~ /^\{/u ? :
1276 0 3 $has_sig ? :
1280 0 0 if $attr =~ /^:optimize\b/u
1283 1 2 if (defined $code and $code =~ /^=(.+)$/su)
1289 0 3 if ($code =~ /\$\s*factory/u)
1300 0 5 /^\{/u ? :
1302 0 3 if ($has_sig) { }
1 2 elsif ($kind eq 'around') { }
1304 0 0 if ($kind eq 'around') { }
1310 0 0 $optim ? :
1325 0 1 $optim ? :
1338 0 2 $optim ? :
1355 6 86 if ($compact_extends)
1358 6 86 if ($compact_with)
1361 1 91 if ($version)
1362 1 0 $version =~ /^[0-9]/u ? :
1365 1 91 if ($kind eq 'abstract') { }
0 91 elsif ($kind eq 'interface') { }
9 82 elsif (length $compact_code) { }
1377 8 84 if ($name and $has_sig) { }
1 83 elsif ($has_sig) { }
79 4 elsif ($name) { }
1406 79 0 $code ? :
1439 14 19 unless defined $rawspec
1441 0 33 if (defined $default and $default =~ /\$\s*(?:self|class|factory)/u) { }
6 27 elsif (defined $default) { }
1443 0 0 if ($default =~ /\$\s*factory/u)
1460 1 36 if ($name =~ /^\$(.+)$/u) { }
1463 0 1 $display_name =~ /^\{/u ? :
1474 3 33 $name =~ /^\{/u ? :
1484 1 32 if (@make_read_only)
1497 0 3 $name =~ /^\{/u ? :
1503 2 1 if ($has_sig)
1505 0 2 $name =~ /^\{/u ? :
1520 0 0 if (ref $_[-1]) { }
1545 119 93 if ($#orig_lines > $#new_lines) { }
1 92 elsif ($#orig_lines < $#new_lines) { }
1547 0 119 if ($owed and $owed > $diff) { }
0 119 elsif ($owed) { }
1556 63 56 $pad_at_end ? :
1604 1 0 if (not $cached or $cached->isa('Type::Tiny::_DeclaredType'))
1606 1 0 if $got
1614 0 87 unless eval "\n\t\t\tpackage Zydeco; # allow namespace::autoclean to clean them\n\t\t\tno warnings 'redefine';\n\t\t\t*${caller}::$name = \$T;\n\t\t\t*${caller}::is_$name = sub (\$) { \$T->()->check(\@_) };\n\t\t\t*${caller}::assert_$name = sub (\$) { \$T->()->assert_return(\@_) };\n\t\t\t1;\n\t\t"
1630 0 38 if ('Zydeco::_Gather'->_already($caller))
1638 38 0 unless $opts{'keywords'}
1642 0 38 if ($opts{'declare'})
1654 38 0 if $want{'try'}
1655 38 0 if ($] >= 5.018) { }
0 0 elsif ($] >= 5.014) { }
1657 38 0 if $want{'-features'}
1661 0 0 if $want{'-features'}
1664 1 37 if $opts{'type_library'}->isa('Type::Library')
1675 0 2 unless $$ref =~ _fetch_re('MxpIncludeSyntax', 'anchor', 'start')
1684 38 0 if $want{'include'}
1696 0 75 unless $$ref =~ _fetch_re('MxpClassSyntax', 'anchor', 'start')
1713 38 0 if $want{'class'}
1718 0 1 unless $$ref =~ _fetch_re('MxpAbstractSyntax', 'anchor', 'start')
1735 38 0 if $want{'abstract'}
1741 0 16 unless $$ref =~ _fetch_re('MxpRoleSyntax', 'anchor', 'start')
1757 76 0 if $want{$kw}
1763 0 0 unless $$ref =~ _fetch_re('MxpToolkitSyntax', 'anchor', 'start')
1772 0 0 if ($imports) { }
1779 0 0 if ($next =~ /^::(.+)$/u) { }
0 0 elsif ($next =~ /^[^\W0-9]/u) { }
1789 0 0 if $imports[0] eq ','
1797 38 0 if $want{'toolkit'}
1811 0 5 unless $$ref =~ _fetch_re('MxpHookSyntax', 'anchor', 'start')
1820 152 0 if $want{$kw}
1828 0 1 unless $$ref =~ _fetch_re('MxpTypeNameSyntax', 'anchor', 'start')
1836 38 0 if $want{'type_name'}
1843 0 6 unless $$ref =~ _fetch_re('MxpExtendsSyntax', 'anchor', 'start')
1851 38 0 if $want{'extends'}
1858 0 11 unless $$ref =~ _fetch_re('MxpWithSyntax', 'anchor', 'start')
1867 38 0 if $want{'with'}
1874 0 3 unless $$ref =~ _fetch_re('MxpRequiresSyntax', 'anchor', 'start')
1884 38 0 if $want{'requires'}
1891 0 33 unless $$ref =~ _fetch_re('MxpHasSyntax', 'anchor', 'start')
1903 19 14 $has_spec ? :
6 27 $has_default ? :
1904 38 0 if $want{'has'}
1911 0 8 unless $$ref =~ _fetch_re('MxpConstantSyntax', 'anchor', 'start')
1919 38 0 if $want{'constant'}
1928 0 25 unless $$ref =~ _fetch_re('MxpMethodSyntax', 'anchor', 'start')
1943 3 22 $attributes ? :
1946 38 0 if $want{'method'}
1955 0 7 unless $$ref =~ _fetch_re('MxpSymMethodSyntax', 'anchor', 'start')
1966 1 6 $attributes ? :
1969 38 0 if $want{'symmethod'}
1978 0 12 unless $$ref =~ _fetch_re('MxpMultiSyntax', 'anchor', 'start')
1993 1 11 $attributes ? :
1996 38 0 if $want{'multi'}
2006 0 3 unless $$ref =~ _fetch_re('MxpModifierSyntax', 'anchor', 'start')
2017 0 3 $attributes ? :
2020 114 0 if $want{$kw}
2026 2 1 if ($$ref =~ _fetch_re('MxpFactorySyntax', 'anchor', 'start'))
2030 0 2 $attributes ? :
2035 0 1 unless $$ref =~ _fetch_re('MxpFactoryViaSyntax', 'anchor', 'start')
2050 38 0 if $want{'factory'}
2055 0 1 unless $$ref =~ _fetch_re('MxpCoerceSyntax', 'anchor', 'start')
2063 0 1 if ($from =~ /^\{/u) { }
1 0 elsif (not $from =~ /^(q\b)|(qq\b)|"|'/u) { }
2069 0 1 if ($via =~ /^\{/u) { }
1 0 elsif (not $via =~ /^(q\b)|(qq\b)|"|'/u) { }
2076 1 0 $code ? :
2077 38 0 if $want{'coerce'}
2082 3 35 unless eval "package $caller; use Zydeco::_Gather -go; 1"
2112 115 9 if (is_HashRef($TARGET)) { }
9 0 elsif (is_Str($TARGET) or is_Str($fallback)) { }
2125 9 115 if ($is_patching)
2127 0 9 if keys %got
2135 24 0 if (is_HashRef($TARGET)) { }
2150 0 2 unless &_define_or_patch(sub {
2158 0 0 unless &_define_or_patch(sub {
2165 0 1 if (@_ == 1 and ref $_[0] eq 'HASH') { }
0 2 elsif (@_ == 1 and ref $_[0] eq 'ARRAY') { }
2173 0 1 unless &_define_or_patch(sub {
2179 1 0 if (is_HashRef($TARGET))
2196 0 40 unless &_define_or_patch(sub {
2204 0 13 unless &_define_do_not_patch(sub {
2212 0 1 unless &_define_do_not_patch(sub {
2227 0 1 unless &_define_do_not_patch(sub {
2242 0 1 unless &_define_do_not_patch(sub {
2258 0 2 unless &_define_do_not_patch(sub {
2274 0 2 unless &_define_do_not_patch(sub {
2282 0 0 unless &_define_do_not_patch(sub {
2290 0 1 unless &_define_do_not_patch(sub {
2298 0 17 unless &_define_or_patch(sub {
2307 0 0 if @imports
2309 0 0 unless &_define_do_not_patch(sub {
2317 0 3 unless &_define_do_not_patch(sub {
2325 0 1 unless &_define_or_patch(sub {
2332 0 3 unless &_define_or_patch(sub {
2340 0 12 unless &_define_or_patch(sub {
2347 0 24 unless &_define_or_patch(sub {
2357 1 0 if ($attr =~ /^order\((.+)\)$/u) { }
2365 1 6 if (defined $order)
2370 0 7 unless &_define_or_patch(sub {
2377 2 10 if ($kind eq 'factory') { }
2379 0 2 unless &_define_or_patch(sub {
2394 0 2 if is_HashRef($TARGET)
2401 0 2 unless ($file)
2405 0 0 if ($file)
2411 0 2 unless ($file)
2416 0 2 if ref $file eq 'ARRAY'
2492 0 12 if exists $package_dfn->{$forbidden}