line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Unit::Test; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
2
|
|
|
2
|
|
43
|
$Test::Unit::Test::VERSION = '0.25_1325'; # added by dist-tools/SetVersion.pl |
4
|
|
|
|
|
|
|
} |
5
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
125
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Test::Unit::Debug qw(debug); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
89
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
10
|
use base qw(Test::Unit::Assert); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1371
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub count_test_cases { |
14
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
15
|
0
|
|
|
|
|
0
|
my $class = ref($self); |
16
|
0
|
|
|
|
|
0
|
croak "call to abstract method ${class}::count_test_cases"; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub run { |
20
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
21
|
0
|
|
|
|
|
0
|
my $class = ref($self); |
22
|
0
|
|
|
|
|
0
|
croak "call to abstract method ${class}::run"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub name { |
26
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
27
|
0
|
|
|
|
|
0
|
my $class = ref($self); |
28
|
0
|
|
|
|
|
0
|
croak "call to abstract method ${class}::name"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub to_string { |
32
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
33
|
0
|
|
|
|
|
0
|
return $self->name(); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub filter_method { |
37
|
16
|
|
|
16
|
0
|
27
|
my $self = shift; |
38
|
16
|
|
|
|
|
23
|
my ($token) = @_; |
39
|
|
|
|
|
|
|
|
40
|
16
|
|
|
|
|
44
|
my $filtered = $self->filter->{$token}; |
41
|
16
|
100
|
|
|
|
223
|
return unless $filtered; |
42
|
|
|
|
|
|
|
|
43
|
15
|
100
|
|
|
|
49
|
if (ref $filtered eq 'ARRAY') { |
|
|
100
|
|
|
|
|
|
44
|
8
|
|
|
|
|
30
|
return grep $self->name eq $_, @$filtered; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif (ref $filtered eq 'CODE') { |
47
|
6
|
|
|
|
|
19
|
return $filtered->($self->name); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
1
|
|
|
|
|
15
|
die "Didn't understand filtering definition for token $token in ", |
51
|
|
|
|
|
|
|
ref($self), "\n"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my %filter = (); |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
0
|
|
sub filter { \%filter } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# use Attribute::Handlers; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# sub Filter : ATTR(CODE) { |
62
|
|
|
|
|
|
|
# my ($pkg, $symbol, $referent, $attr, $data, $phase) = @_; |
63
|
|
|
|
|
|
|
# print "attr $attr (data $data) on $pkg\::*{$symbol}{NAME}\n"; |
64
|
|
|
|
|
|
|
# # return (); |
65
|
|
|
|
|
|
|
# } |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _find_sym { # pinched from Attribute::Handlers |
68
|
0
|
|
|
0
|
|
|
my ($pkg, $ref) = @_; |
69
|
0
|
|
|
|
|
|
my $type = ref($ref); |
70
|
2
|
|
|
2
|
|
13
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
128
|
|
71
|
0
|
|
|
|
|
|
warn "type $type\n"; |
72
|
0
|
|
|
|
|
|
while (my ($name, $sym) = each %{$pkg."::"} ) { |
|
0
|
|
|
|
|
|
|
73
|
2
|
|
|
2
|
|
2413
|
use Data::Dumper; |
|
2
|
|
|
|
|
15799
|
|
|
2
|
|
|
|
|
1056
|
|
74
|
|
|
|
|
|
|
# warn Dumper(*$sym); |
75
|
0
|
|
0
|
|
|
|
warn "name $name sym $sym (" . (*{$sym}{$type} || '?') . ") matches?\n"; |
76
|
0
|
0
|
0
|
|
|
|
return \$sym if *{$sym}{$type} && *{$sym}{$type} == $ref; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub MODIFY_CODE_ATTRIBUTES { |
81
|
0
|
|
|
0
|
|
|
my ($pkg, $subref, @attrs) = @_; |
82
|
0
|
|
|
|
|
|
my @bad = (); |
83
|
0
|
|
|
|
|
|
foreach my $attr (@attrs) { |
84
|
0
|
0
|
|
|
|
|
if ($attr =~ /^Filter\((.*)\)$/) { |
85
|
0
|
|
|
|
|
|
my @tokens = split /\s+|\s*,\s*/, $1; |
86
|
0
|
|
|
|
|
|
my $sym = _find_sym($pkg, $subref); |
87
|
0
|
0
|
|
|
|
|
if ($sym) { |
88
|
0
|
|
|
|
|
|
push @{ $filter{$_} }, *{$sym}{NAME} foreach @tokens; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
else { |
91
|
0
|
0
|
|
|
|
|
warn "Couldn't find symbol for $subref in $pkg\n" unless $sym; |
92
|
0
|
|
|
|
|
|
push @bad, $attr; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
else { |
96
|
0
|
|
|
|
|
|
push @bad, $attr; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
|
return @bad; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
__END__ |