Branch Coverage

blib/lib/Class/Contract.pm
Criterion Covered Total %
branch 137 292 46.9


line true false branch
45 0 32 grep(/^old$/, @_) ? :
49 0 5 if defined *{$caller . '::croak';}{'CODE'}
50 0 5 if defined *{$caller . '::carp';}{'CODE'}
58 0 0 if grep /^old$/, @_
65 0 0 $_[1] ? :
0 0 !$#_ ? :
66 0 0 $#_ ? :
0 0 unless defined $_
85 0 48 exists $no_opt{'__ALL__'} ? :
0 48 exists $no_opt{$_[0]} ? :
95 312 611 unless ($c[0] =~ /^Class::Contract$/)
96 312 0 unless $owner
97 312 0 unless ($c[1] =~ /^\(eval \d+\)$/)
98 312 0 wantarray ? :
115 6 114 unless $name
117 0 120 if (defined $contract{$owner}{$kind}{$name})
118 0 0 if $name
135 114 6 unless $$current{'gentype'} =~ /\A(SCALAR|ARRAY|HASH)\z/
165 0 180 unless defined $current
166 1 179 if $current->isa('Class::Contract::attr') and $field eq 'impl'
176 93 86 if ($field eq 'impl' and not $current->isa('Class::Contract::ctor') || $current->isa('Class::Contract::dtor') || $current->isa('Class::Contract::clone')) { }
188 0 0 unless $msg_target
218 1 16 if $_->isa($owner)
244 3 49 ref $proto ? :
247 0 52 if $class =~ /^Class::Contract::Old::_/
249 0 52 if ($contract{$class}{'use_old'})
253 0 0 if ($obj)
257 0 0 if exists $data{$$obj}
267 0 0 unless @context
270 0 0 unless $contract{$class}{'use_old'}
277 0 36 wantarray ? :
280 0 0 unless @value
285 0 324 if (@_)
288 0 0 unless defined *{join ref $_[0] || $_[0], '::';}
292 0 324 unless @context
297 0 0 unless @context
310 13 12 unless $$spec{'parents'}
312 0 16 if ($$parent{'use_old'} and not $$spec{'use_old'})
318 0 77 unless $$parent{$clause}
320 22 0 unless (defined $$spec{$clause}{$name} or exists $inherited_clause{$name})
329 20 58 if ($clause =~ /^(ctor|clone|dtor)$/)
330 14 6 if (defined $$parent{$clause}{$name}{'impl'} and @{$$parent{$clause}{$name}{'impl'};})
333 14 0 if (@impl)
336 2 19 if exists $seen{$item}
344 8 6 $clause ne 'dtor' ? :
349 58 20 if ($clause eq 'method')
350 0 58 if (not defined $$spec{$clause}{$name}{'impl'} or $inherited_impl{$name})
355 1 57 if $$parent{$clause}{$name}{'private'} and not $$spec{$clause}{$name}{'private'}
362 6 71 unless $$parent{$clause}{$name}{'post'}
2 75 if (@{[] unless $$parent{$clause}{$name}{'post'};})
364 2 0 if (@post)
367 0 3 if exists $seen{$item}
379 0 15 if (defined $$parent{'invar'} and @{$$parent{'invar'};})
380 0 0 unless defined $$spec{'invar'}
382 0 0 if (@invar)
385 0 0 if exists $seen{$_}
394 13 11 unless $$spec{'parents'}
401 3 5 if ($$attr{'shared'})
406 3 0 $$attr{'type'} eq 'SCALAR' ? :
0 3 $$attr{'type'} eq 'HASH' ? :
0 3 $$attr{'type'} eq 'ARRAY' ? :
415 1 2 unless $$attr{'shared'} or ref $_[0]
419 1 1 unless $classname->isa($caller)
423 1 0 $$attr{'shared'} ? :
425 1 0 $$attr{'shared'} ? :
432 0 1 if @fail
440 0 1 if @{$$attr{'post'};}
455 5 95 unless ($$method{'impl'})
456 4 1 if ($$method{'abstract'}) { }
471 0 48 if $$method{'private'} and not $classname->isa($caller)
477 48 0 $$method{'shared'} ? :
481 0 48 unless $$method{'shared'} or ref $self
486 11 37 if @fail
489 0 37 wantarray ? :
495 35 0 if caller ne $classname
508 0 160 if (ref self || self) =~ /^Class::Contract::Old::_/
511 39 121 unless $$class_spec{$kind}{$name}{$type}
515 41 29 if $$spec{'opt'} and no_opt($$spec{'owner'}) or $$spec{'code'}(@args)
520 0 76 @errors ? :
76 84 unless $type eq 'pre'
521 31 53 if @specs and not @errors
524 11 42 unless $$class_spec{'parents'}
526 0 48 unless exists $$parent{$kind}{$name}
528 20 28 unless ($has_pre)
529 5 15 unless $$parent{'parents'}
530 4 11 if _hasa($p, $kind, $name, 'pre')
534 32 16 if ($has_pre)
536 20 12 unless @par_err
545 0 15 unless defined $contract{$class}{$kind}{$name}
547 3 12 unless $contract{$class}{$kind}{$name}{$type}
4 11 @{[] unless $contract{$class}{$kind}{$name}{$type};} ? :
548 11 4 unless ($has)
549 11 0 unless $contract{$class}{'parents'}
550 0 0 if _hasa($ancestor, $kind, $name, $type)
560 1 2 if $contract{$class}{'abstract'}
570 1 0 unless ($$attr{$attrname} and $$attr{$attrname}{'shared'})
575 1 0 $$attr{$attrname}{'type'} eq 'SCALAR' ? :
0 1 $$attr{$attrname}{'type'} eq 'HASH' ? :
0 1 $$attr{$attrname}{'type'} eq 'ARRAY' ? :
587 0 0 unless $ref and not $ref =~ /^(HASH|ARRAY|SCALAR|GLOB|FORMAT|CODE|Regexp|REF)$/
592 0 0 if exists $data{$$self}
605 8 15 if $noctor
616 0 23 if ($$ctor{'shared'}) { }
626 0 0 if @fail
633 0 0 if caller ne $classname
654 0 2 if @fail
661 2 0 if caller ne $classname
682 0 6 if ($$dtor{'shared'}) { }
687 0 0 if caller() ne 'Class::Contract'
690 0 0 if ref $self
696 0 0 if @fail
708 0 6 if $dtorcount++
714 0 1 if caller() ne 'Class::Contract'
722 0 1 if @fail
725 0 1 unless $$dtor{'impl'}
729 1 0 if caller ne $classname
739 1 0 if exists $data{${$_[0];}}
744 17 6 unless (defined &{"${classname}::DESTROY";})
748 0 1 if exists $data{${$_[0];}}
757 12 11 unless $$spec{'clone'}
768 0 23 if $$clause{'shared'}
770 0 23 if $clone_count++
782 0 0 if @fail
785 0 0 unless $$clause{'impl'}
789 0 0 if caller ne $classname
806 0 0 unless $ref = ref $_[0]
807 0 0 if exists $seen{$_[0]}
813 0 0 $_[0]->can('clone') ? :
0 0 $_[0] =~ /${a}GLOB$z/ ? :
0 0 $_[0] =~ /${a}REF$z/ ? :
0 0 $_[0] =~ /${a}Regexp$z/ ? :
0 0 $_[0] =~ /${a}CODE$z/ ? :
0 0 $_[0] =~ /${a}FORMAT$z/ ? :
0 0 $_[0] =~ /${a}SCALAR$z/ ? :
0 0 $_[0] =~ /${a}ARRAY$z/ ? :
0 0 $_[0] =~ /${a}HASH$z/ ? :
821 0 0 $ref =~ /^(HASH|ARRAY|SCALAR|GLOB|FORMAT|CODE|Regexp|REF)$/ ? :
825 0 0 unless --$depth and $seen{$_[0]} = $rval
836 0 0 unless defined *{$_[0] . '::';}
838 0 0 if defined *{$_[1] . '::';}
841 0 0 unless my($varname) = $glob =~ /^\*$_[0]::(.*)/
844 0 0 if defined $ref
869 0 0 @$posts == 1 ? :
0 0 if $^W
906 0 0 if ($_[3])
939 0 0 if ($_[3])