blib/lib/Test2/Mock.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
condition | 62 | 75 | 82.6 |
line | l | !l | condition |
---|---|---|---|
160 | 9 | 4 | $stash->{'AUTOLOAD'} and *{$stash->{'AUTOLOAD'};}{"CODE"} |
162 | 9 | 2 | $stash->{'can'} and *{$stash->{'can'};}{"CODE"} |
line | !l | l&&!r | l&&r | condition |
---|---|---|---|---|
301 | 2 | 0 | 13 | $ref and @$ref |
345 | 11 | 6 | 107 | ref $arg and &reftype($arg) eq "CODE" |
350 | 2 | 6 | 9 | defined $arg and not ref $arg |
8 | 3 | 6 | defined $arg and not ref $arg and $arg =~ /^(rw|ro|wo)$/ | |
364 | 2 | 4 | 0 | $val and $is |
409 | 1 | 2 | 1 | $sig eq "&" and $class->can($sym) |
413 | 55 | 79 | 2 | $add and $orig |
134 | 0 | 2 | $add and $orig and &reftype($orig) ne 'SCALAR' || defined $$orig | |
420 | 131 | 0 | 3 | $self->{'_track'} and $sig eq "&" |
467 | 1 | 0 | 2 | $ref and @$ref |
488 | 1 | 0 | 119 | $ref and @$ref |
line | l | !l | condition |
---|---|---|---|
26 | 0 | 77 | $self->{'sub_tracking'} ||= {} |
27 | 0 | 77 | $self->{'call_tracking'} ||= [] |
169 | 10 | 1 | eval qq[package $class;\n#line $line "$file (Generated AUTOLOAD)"\nour \$AUTOLOAD;\n sub {\n my (\$self) = \@_;\n my (\$pkg, \$name) = (\$AUTOLOAD =~ m/^(.*)::([^:]+)\$/g);\n \$AUTOLOAD = undef;\n\n return if \$name eq 'DESTROY';\n my \$sub = sub {\n my \$self = shift;\n (\$self->{\$name}) = \@_ if \@_;\n return \$self->{\$name};\n };\n\n \$c->add(\$name => \$sub);\n\n if (\$c->{_track}) {\n my \$call = {sub_name => \$name, sub_ref => \$sub, args => [\@_]};\n push \@{\$c->{sub_tracking}->{\$name}} => \$call;\n push \@{\$c->{call_tracking}} => \$call;\n }\n\n goto &\$sub;\n }\n] || die("Failed generating AUTOLOAD sub: $@") |
198 | 10 | 0 | eval qq[package $class;\n#line $line "$file (Generated can)"\nuse Scalar::Util 'reftype';\n sub {\n my (\$self, \$meth) = \@_;\n if (\$self->SUPER::can(\$meth)) {\n return \$self->SUPER::can(\$meth);\n }\n elsif (ref \$self && reftype \$self eq 'HASH' && exists \$self->{\$meth}) {\n return sub { shift->\$meth(\@_) };\n }\n return undef;\n }\n] || die("Failed generating can method: $@") |
401 | 48 | 55 | $self->{'_symbols'} ||= {} |
417 | 9 | 125 | $$syms{"$sig$sym"} ||= [] |
500 | 50 | 0 | $self->{'_symbols'} || (return) |
line | l | !l&&r | !l&&!r | condition |
---|---|---|---|---|
136 | 4 | 1 | 1 | $NEW{$type} || croak("'${type}' is not a known constructor type") |
147 | 7 | 1 | 1 | $NEW{$type} || croak("'${type}' is not a known constructor type") |
359 | 2 | 4 | 0 | delete $arg->{'field'} || $param |
366 | 2 | 4 | 0 | $is ||= $val ? "val" : "rw" |
409 | 53 | 79 | 7 | $orig or $add |
132 | 3 | 4 | $orig or $add or $set | |
82 | 1 | 3 | $orig or $add or $set or $sig eq "&" and $class->can($sym) | |
413 | 1 | 1 | 0 | &reftype($orig) ne 'SCALAR' || defined $$orig |