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