Branch Coverage

blib/lib/Zydeco.pm
Criterion Covered Total %
branch 324 516 62.7


line true false branch
42 4 87 if $kind =~ /role_generator/u
46 4 83 if ($kind =~ /class_generator/u) { }
60 130 221 if ($action eq '-gather') { }
39 182 elsif ($action eq '-go') { }
91 91 elsif ($action eq '-parent') { }
91 0 elsif ($action eq '-unparent') { }
63 91 312 if (my($kind, $pkg) = $k =~ /^(class|role|class_generator|role_generator):(.+)$/u) { }
64 0 91 unless $stack{$me}{$caller}
91 0 if (my(@stack) = @{[] unless $stack{$me}{$caller};})
65 91 0 if $stack[-1] eq $pkg
66 25 66 if (@stack)
80 0 39 if ($gather{$me}{$caller}{'_defer_role'})
84 0 39 if ($gather{$me}{$caller}{'_defer_role_generator'})
88 1 38 if ($gather{$me}{$caller}{'_defer_class_generator'})
91 5 34 if ($gather{$me}{$caller}{'_defer_class'})
95 0 36 if ($gather{$me}{$caller}{'debug'})
117 3 2 unless $classes
125 7 17 if $spec->{'_depth'} > $max_depth
129 60 24 unless $spec->{'_depth'} == $depth
132 3 21 unless ($class_hash{$parent_key})
750 0 148 unless "$GRAMMAR" =~ m[<$name>(.+)</$name>]su
754 456 2241 if (my($named_capture) = /# CAPTURE:(\w+)/u)
761 0 40 $opts{'anchor'} eq 'both' ? :
0 40 $opts{'anchor'} eq 'end' ? :
108 40 $opts{'anchor'} eq 'start' ? :
777 6 42 unless $sig
785 0 65 unless $sig
789 5 60 if ($sig =~ /^((?&PerlBlock)) $GRAMMAR/osux) { }
51 9 elsif ($sig =~ /^((?&MxpTypeSpec)) $GRAMMAR/osux) { }
798 1 50 $type =~ /#/u ? :
808 14 51 if ($sig =~ /^\*((?&PerlIdentifier)) $GRAMMAR/osux) { }
1 50 elsif ($sig =~ /^ ( [\$\@\%] ) (?: [=),?] | (?&PerlNWS) | $ ) $GRAMMAR/osux) { }
50 0 elsif ($sig =~ /^((?&MxpSignatureVariable)) $GRAMMAR/osux) { }
836 5 60 if ($sig =~ /^\?/u) { }
2 58 elsif ($sig =~ /^=((?&PerlOWS))((?&PerlScalarExpression)) $GRAMMAR/osux) { }
847 0 2 if ($default =~ / \$ (?: class|self) /osux)
854 23 42 if ($sig)
855 23 0 if ($sig =~ /^,/u) { }
869 2 40 if ($seen_named and $seen_pos)
876 0 2 if (grep $_->{'positional'}, @parsed)
883 0 6 if ($is_optional) { }
0 6 elsif ($p->{'default'}) { }
0 6 elsif ($p->{'name'} =~ /^[\@\%]/u) { }
903 14 45 if $seen_named
904 3 56 if ($p->{'name'} =~ /^[\@\%]/u) { }
905 0 3 if (@parsed)
916 2 1 if ($p->{'type'} eq "Any")
917 1 1 substr($p->{'name'}, 0, 1) eq '%' ? :
924 3 56 if ($p->{'type_is_block'}) { }
930 5 49 if (exists $p->{'optional'} or exists $p->{'default'} or $p->{'slurpy'})
932 5 5 if exists $p->{'optional'}
933 2 8 if exists $p->{'default'}
934 3 7 if exists $p->{'slurpy'}
939 7 35 if $seen_named
942 2 40 if (@head or @tail)
945 2 2 $_->{'type_is_block'} ? :
946 0 2 $_->{'type_is_block'} ? :
947 2 0 $head_stuff ? :
2 0 $tail_stuff ? :
975 3 34 if ($rolelist =~ /^((?&PerlBlock)) $GRAMMAR/osux) { }
34 0 elsif ($rolelist =~ /^((?&PerlQualifiedIdentifier)) $GRAMMAR/osux) { }
991 8 29 if ($rolelist =~ /^\?/sux) { }
6 23 elsif ($rolelist =~ /^((?&PerlOWS)(?&PerlList)(?&PerlOWS)) $GRAMMAR/osux) { }
992 0 8 if ($kind eq "class")
1005 3 34 if ($role_is_block) { }
1011 6 31 if ($role_params)
1016 6 31 if (length $rolelist)
1017 6 0 if ($rolelist =~ /^,/u) { }
1031 0 53 unless $_[1]
1037 0 36 unless $names
1063 2 1 $has_sig ? :
1067 0 0 if $attr =~ /^:optimize\b/u
1070 0 3 if (defined $code and $code =~ /^=(.+)$/su)
1075 1 2 if ($via)
1076 0 1 $name =~ /^\{/u ? :
0 1 $via =~ /^\{/u ? :
1083 0 2 unless ($has_sig)
1085 0 0 $name =~ /^\{/u ? :
0 0 $optim ? :
1096 0 2 $name =~ /^\{/u ? :
0 2 $optim ? :
1113 19 13 $has_sig ? :
1117 3 1 if $attr =~ /^:optimize\b/u
1120 0 32 if (defined $code and $code =~ /^=(.+)$/su)
1126 1 31 if (defined $name and $name =~ /^\$(.+)$/u)
1131 1 31 if ($code =~ /\$\s*factory/u)
1136 7 25 if ($kind eq "symmethod")
1142 30 2 if (defined $name and not defined $lex_name) { }
1143 17 13 if ($has_sig) { }
1145 0 17 $name =~ /^\{/u ? :
2 15 $optim ? :
1160 0 13 $name =~ /^\{/u ? :
0 13 $optim ? :
1173 0 2 if $kind eq "symmethod"
1175 2 0 if ($has_sig) { }
1177 1 1 $optim ? :
1190 0 0 $optim ? :
1201 1 31 if ($lex_name)
1212 4 12 if ($name =~ /^\$/u)
1216 16 0 $has_sig ? :
1221 0 2 if $attr =~ /^:optimize\b/u
1222 2 0 if (my($alias) = $attr =~ /^:alias\((.+)\)$/u)
1227 6 10 if (defined $code and $code =~ /^=(.+)$/su)
1234 16 0 if ($has_sig) { }
1235 2 14 $kind eq 'factory' ? :
1244 4 12 $name =~ /^\{/u ? :
1258 0 0 $kind eq 'factory' ? :
1265 0 0 $name =~ /^\{/u ? :
1281 0 3 $has_sig ? :
1285 0 0 if $attr =~ /^:optimize\b/u
1288 1 2 if (defined $code and $code =~ /^=(.+)$/su)
1294 0 3 if ($code =~ /\$\s*factory/u)
1305 0 5 /^\{/u ? :
1307 0 3 if ($has_sig) { }
1 2 elsif ($kind eq 'around') { }
1309 0 0 if ($kind eq 'around') { }
1315 0 0 $optim ? :
1330 0 1 $optim ? :
1343 0 2 $optim ? :
1360 6 90 if ($compact_extends)
1363 6 90 if ($compact_with)
1366 1 95 if ($version)
1367 1 0 $version =~ /^[0-9]/u ? :
1370 1 95 if ($kind eq 'abstract') { }
0 95 elsif ($kind eq 'interface') { }
9 86 elsif (length $compact_code) { }
1382 8 88 if ($name and $has_sig) { }
1 87 elsif ($has_sig) { }
83 4 elsif ($name) { }
1411 83 0 $code ? :
1444 14 19 unless defined $rawspec
1446 0 33 if (defined $default and $default =~ /\$\s*(?:self|class|factory)/u) { }
6 27 elsif (defined $default) { }
1448 0 0 if ($default =~ /\$\s*factory/u)
1467 1 36 if ($name =~ /^\$(.+)$/u) { }
1470 0 1 $display_name =~ /^\{/u ? :
1481 3 33 $name =~ /^\{/u ? :
1491 1 32 if (@make_read_only)
1504 0 3 $name =~ /^\{/u ? :
1510 2 1 if ($has_sig)
1512 0 2 $name =~ /^\{/u ? :
1527 0 0 if (ref $_[-1]) { }
1552 127 95 if ($#orig_lines > $#new_lines) { }
1 94 elsif ($#orig_lines < $#new_lines) { }
1554 0 127 if ($owed and $owed > $diff) { }
0 127 elsif ($owed) { }
1563 67 60 $pad_at_end ? :
1613 2 0 if (not $cached or $cached->isa("Type::Tiny::_DeclaredType"))
1615 2 0 if $got
1623 0 91 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"
1639 0 39 if ("Zydeco::_Gather"->_already($caller))
1647 39 0 unless $opts{'keywords'}
1651 0 39 if ($opts{'declare'})
1663 39 0 if $want{'try'}
1664 39 0 if ($] >= 5.018) { }
0 0 elsif ($] >= 5.014) { }
1666 39 0 if $want{'-features'}
1670 0 0 if $want{'-features'}
1673 1 38 if $opts{'type_library'}->isa("Type::Library")
1684 0 2 unless $$ref =~ _fetch_re("MxpIncludeSyntax", "anchor", "start")
1693 39 0 if $want{'include'}
1705 0 76 unless $$ref =~ _fetch_re("MxpClassSyntax", "anchor", "start")
1722 39 0 if $want{'class'}
1727 0 1 unless $$ref =~ _fetch_re("MxpAbstractSyntax", "anchor", "start")
1744 39 0 if $want{'abstract'}
1750 0 19 unless $$ref =~ _fetch_re("MxpRoleSyntax", "anchor", "start")
1766 78 0 if $want{$kw}
1772 0 0 unless $$ref =~ _fetch_re("MxpToolkitSyntax", "anchor", "start")
1781 0 0 if ($imports) { }
1788 0 0 if ($next =~ /^::(.+)$/u) { }
0 0 elsif ($next =~ /^[^\W0-9]/u) { }
1798 0 0 if $imports[0] eq ","
1806 39 0 if $want{'toolkit'}
1820 0 5 unless $$ref =~ _fetch_re("MxpHookSyntax", "anchor", "start")
1829 156 0 if $want{$kw}
1837 0 1 unless $$ref =~ _fetch_re("MxpTypeNameSyntax", "anchor", "start")
1845 39 0 if $want{'type_name'}
1852 0 6 unless $$ref =~ _fetch_re("MxpExtendsSyntax", "anchor", "start")
1860 39 0 if $want{'extends'}
1867 0 13 unless $$ref =~ _fetch_re("MxpWithSyntax", "anchor", "start")
1876 39 0 if $want{'with'}
1883 0 3 unless $$ref =~ _fetch_re("MxpRequiresSyntax", "anchor", "start")
1893 39 0 if $want{'requires'}
1901 0 33 unless $$ref =~ _fetch_re("MxpHasSyntax", "anchor", "start")
1913 19 14 $has_spec ? :
6 27 $has_default ? :
1914 117 0 if $want{$kw}
1922 0 8 unless $$ref =~ _fetch_re("MxpConstantSyntax", "anchor", "start")
1930 39 0 if $want{'constant'}
1939 0 25 unless $$ref =~ _fetch_re("MxpMethodSyntax", "anchor", "start")
1954 3 22 $attributes ? :
1957 39 0 if $want{'method'}
1966 0 7 unless $$ref =~ _fetch_re("MxpSymMethodSyntax", "anchor", "start")
1977 1 6 $attributes ? :
1980 39 0 if $want{'symmethod'}
1989 0 16 unless $$ref =~ _fetch_re("MxpMultiSyntax", "anchor", "start")
2004 2 14 $attributes ? :
2007 39 0 if $want{'multi'}
2017 0 3 unless $$ref =~ _fetch_re("MxpModifierSyntax", "anchor", "start")
2028 0 3 $attributes ? :
2031 117 0 if $want{$kw}
2037 2 1 if ($$ref =~ _fetch_re("MxpFactorySyntax", "anchor", "start"))
2041 0 2 $attributes ? :
2046 0 1 unless $$ref =~ _fetch_re("MxpFactoryViaSyntax", "anchor", "start")
2061 39 0 if $want{'factory'}
2066 0 1 unless $$ref =~ _fetch_re("MxpCoerceSyntax", "anchor", "start")
2074 0 1 if ($from =~ /^\{/u) { }
1 0 elsif (not $from =~ /^(q\b)|(qq\b)|"|'/u) { }
2080 0 1 if ($via =~ /^\{/u) { }
1 0 elsif (not $via =~ /^(q\b)|(qq\b)|"|'/u) { }
2087 1 0 $code ? :
2088 39 0 if $want{'coerce'}
2093 3 36 unless eval "package $caller; use Zydeco::_Gather -go; 1"
2123 121 9 if (is_HashRef($TARGET)) { }
9 0 elsif (is_Str($TARGET) or is_Str($fallback)) { }
2136 9 121 if ($is_patching)
2138 0 9 if keys %got
2146 24 0 if (is_HashRef($TARGET)) { }
2161 0 2 unless &_define_or_patch(sub {
2169 0 0 unless &_define_or_patch(sub {
2176 0 1 if (@_ == 1 and ref $_[0] eq 'HASH') { }
0 2 elsif (@_ == 1 and ref $_[0] eq 'ARRAY') { }
2184 0 1 unless &_define_or_patch(sub {
2190 1 0 if (is_HashRef($TARGET))
2207 2 38 if ($kw eq 'param') { }
1 37 elsif ($kw eq 'field') { }
2208 0 0 unless (exists $spec{'default'} or exists $spec{'builder'})
2214 0 1 if (defined(my $init_arg = $spec{'init_arg'}))
2215 0 0 unless $init_arg =~ /\A_/u
2218 0 0 unless (exists $spec{'default'} or exists $spec{'builder'})
2224 0 40 unless &_define_or_patch(sub {
2232 0 13 unless &_define_do_not_patch(sub {
2240 0 1 unless &_define_do_not_patch(sub {
2255 0 1 unless &_define_do_not_patch(sub {
2270 0 1 unless &_define_do_not_patch(sub {
2286 0 2 unless &_define_do_not_patch(sub {
2302 0 2 unless &_define_do_not_patch(sub {
2310 0 0 unless &_define_do_not_patch(sub {
2318 0 1 unless &_define_do_not_patch(sub {
2326 0 19 unless &_define_or_patch(sub {
2335 0 0 if @imports
2337 0 0 unless &_define_do_not_patch(sub {
2345 0 3 unless &_define_do_not_patch(sub {
2353 0 1 unless &_define_or_patch(sub {
2360 0 3 unless &_define_or_patch(sub {
2368 0 12 unless &_define_or_patch(sub {
2375 0 24 unless &_define_or_patch(sub {
2385 1 0 if ($attr =~ /^order\((.+)\)$/u) { }
2393 1 6 if (defined $order)
2398 0 7 unless &_define_or_patch(sub {
2405 2 14 if ($kind eq 'factory') { }
2407 0 2 unless &_define_or_patch(sub {
2422 0 2 if is_HashRef($TARGET)
2429 0 2 unless ($file)
2433 0 0 if ($file)
2439 0 2 unless ($file)
2444 0 2 if ref $file eq "ARRAY"
2520 0 12 if exists $package_dfn->{$forbidden}