blib/lib/Test/Unit/Assertion/CodeRef.pm

filter: Statementstmt 55.8% 19 / 34 Branchbran 10.0% 1 / 10 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 75.0% 6 / 8 Podpod 66.6% 2 / 3 totaltotal 38.8% 28 / 72 CC 10 SCAR 32.5
CC
10
Cov
36%
do_assertion
56.0
to_string
12.0
new
2.0
CRAP 25.7
« blib/lib/Test/Unit/TkTestRunner.pm ↑ Summary blib/lib/Test/Unit/Test.pm »
1 package Test::Unit::Assertion::CodeRef;
2 BEGIN {
3 6 ▶ $Test::Unit::Assertion::CodeRef::VERSION = '0.25_1325'; # added by dist-tools/SetVersion.pl
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5  
6 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use base qw/Test::Unit::Assertion/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use Test::Unit::Debug qw(debug);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 my $deparser;
13  
14 sub new {
15 60 ▶ my $class = shift;
Subroutine new: called CC=2 SCAR=7.0
Pod documented
16 60 my $code = shift;
17 60 ▶ croak "$class\::new needs a CODEREF" unless ref($code) eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $code eq "CODE" 0 60 60
18 60 bless \$code => $class;
19 }
20  
21 sub do_assertion {
22 0 ▶ my $self = shift;
Subroutine do_assertion: not called CC=7 SCAR=40.3
Pod documented
23 0 my $possible_object = $_[0];
24 0 ▶ debug("Called do_assertion(" . ($possible_object || 'undef') . ")\n");
Condition0%0/2
$possible_object || 'undef'
l!l
00
MC/DC0%0/1
$possible_object || 'undef'
$possible_object
Truth table0%0/2
A
A= $possible_object
Aresult
11
00
25 0 ▶ if (ref($possible_object) and
Branch: 1 branch
BranchTrueFalseTotal
if (ref $possible_object and ref $possible_object ne 'Regexp' and eval { do { $possible_object->isa('UNIVERSAL') } }) { } 0 0 0
Condition0%0/6
ref $possible_object and ref $possible_object ne "Regexp" and eval { do { $possible_object->isa("UNIVERSAL") } }
!ll&&!rl&&r
000
ref $possible_object and ref $possible_object ne "Regexp"
!ll&&!rl&&r
000
MC/DC0%0/3
ref $possible_object and ref $possible_object ne "Regexp" and eval { do { $possible_object->isa("UNIVERSAL") } }
ref $possible_object ref $possible_object ne "Regexp" eval { do { $possible_object->isa("UNIVERSAL") } }
Truth table0%0/4
A and B and C
A= ref $possible_objectB= ref $possible_object ne "Regexp"C= eval { do { $possible_object->isa("UNIVERSAL") } }
ABCresult
0XX0
10X0
1100
1111
26 ref($possible_object) ne 'Regexp' and
27 0 eval { $possible_object->isa('UNIVERSAL') })
28 {
29 0 debug(" [$possible_object] isa [" . ref($possible_object) . "]\n");
30 0 $possible_object->$$self(@_[1..$#_]);
31 }
32 else {
33 debug(" asserting [$self]"
34 0 ▶ . (@_ ? " on args " . join(', ', map { $_ || '<undef>' } @_) : '')
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$_ or "<undef>" 0 0 0
35 . "\n");
36 0 $$self->(@_);
37 }
38 }
39  
40 sub to_string {
41 0 ▶ my $self = shift;
Subroutine to_string: not called CC=3 SCAR=24.8
Pod undocumented
42 0 ▶ if (eval "require B::Deparse") {
Branch: 1 branch
BranchTrueFalseTotal
if (eval 'require B::Deparse') { } 0 0 0
43 0 ▶ $deparser ||= B::Deparse->new("-p");
Condition0%0/3
$deparser ||= "B::Deparse"->new("-p")
l!l&&r!l&&!r
000
MC/DC0%0/2
$deparser ||= "B::Deparse"->new("-p")
$deparser "B::Deparse"->new("-p")
Truth table0%0/3
A ||= B
A= $deparserB= "B::Deparse"->new("-p")
ABresult
1X1
011
000
44 0 return join '', "sub ", $deparser->coderef2text($$self);
45 }
46 else {
47 0 return "sub {
48 # If you had a working B::Deparse, you'd know what was in
49 # this subroutine.
50 }";
51 }
52 }
53  
54 6 1;
55 __END__
« blib/lib/Test/Unit/TkTestRunner.pm ↑ Summary blib/lib/Test/Unit/Test.pm »