| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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'
MC/DC0%0/1
$possible_object || 'undef'
$possible_object
Truth table0%0/2
A
A= $possible_object
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if (ref($possible_object) and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
ref $possible_object and ref $possible_object ne "Regexp" and eval {
do {
$possible_object->isa("UNIVERSAL")
}
}
ref $possible_object and ref $possible_object ne "Regexp"
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")
}
}
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | $deparser ||= B::Deparse->new("-p"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$deparser ||= "B::Deparse"->new("-p")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||