line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Unit::Assertion::CodeRef; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
2
|
|
|
2
|
|
44
|
$Test::Unit::Assertion::CodeRef::VERSION = '0.25_1325'; # added by dist-tools/SetVersion.pl |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
7
|
2
|
|
|
2
|
|
10
|
use base qw/Test::Unit::Assertion/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1211
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
98
|
|
10
|
2
|
|
|
2
|
|
10
|
use Test::Unit::Debug qw(debug); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
735
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $deparser; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
36
|
|
|
36
|
1
|
116
|
my $class = shift; |
16
|
36
|
|
|
|
|
42
|
my $code = shift; |
17
|
36
|
50
|
|
|
|
82
|
croak "$class\::new needs a CODEREF" unless ref($code) eq 'CODE'; |
18
|
36
|
|
|
|
|
148
|
bless \$code => $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub do_assertion { |
22
|
224
|
|
|
224
|
1
|
436
|
my $self = shift; |
23
|
224
|
|
|
|
|
312
|
my $possible_object = $_[0]; |
24
|
224
|
|
100
|
|
|
1274
|
debug("Called do_assertion(" . ($possible_object || 'undef') . ")\n"); |
25
|
224
|
100
|
100
|
|
|
933
|
if (ref($possible_object) and |
|
|
|
100
|
|
|
|
|
26
|
|
|
|
|
|
|
ref($possible_object) ne 'Regexp' and |
27
|
10
|
|
|
|
|
97
|
eval { $possible_object->isa('UNIVERSAL') }) |
28
|
|
|
|
|
|
|
{ |
29
|
4
|
|
|
|
|
25
|
debug(" [$possible_object] isa [" . ref($possible_object) . "]\n"); |
30
|
4
|
|
|
|
|
24
|
$possible_object->$$self(@_[1..$#_]); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
else { |
33
|
450
|
100
|
|
|
|
3304
|
debug(" asserting [$self]" |
34
|
220
|
100
|
|
|
|
984
|
. (@_ ? " on args " . join(', ', map { $_ || '' } @_) : '') |
35
|
|
|
|
|
|
|
. "\n"); |
36
|
220
|
|
|
|
|
1721
|
$$self->(@_); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub to_string { |
41
|
227
|
|
|
227
|
0
|
416
|
my $self = shift; |
42
|
227
|
50
|
|
|
|
18981
|
if (eval "require B::Deparse") { |
43
|
227
|
|
66
|
|
|
819
|
$deparser ||= B::Deparse->new("-p"); |
44
|
227
|
|
|
|
|
1501879
|
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
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
__END__ |