line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Count; |
2
|
|
|
|
|
|
|
$Test::Count::VERSION = '0.1104'; |
3
|
4
|
|
|
4
|
|
155391
|
use warnings; |
|
4
|
|
|
|
|
29
|
|
|
4
|
|
|
|
|
137
|
|
4
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
136
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
1009
|
use parent 'Test::Count::Base'; |
|
4
|
|
|
|
|
600
|
|
|
4
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1991
|
use Test::Count::Parser (); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
2293
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub _in_fh |
11
|
|
|
|
|
|
|
{ |
12
|
39
|
|
|
39
|
|
89
|
my $self = shift; |
13
|
39
|
100
|
|
|
|
116
|
if (@_) |
14
|
|
|
|
|
|
|
{ |
15
|
13
|
|
|
|
|
43
|
$self->{'_in_fh'} = shift; |
16
|
|
|
|
|
|
|
} |
17
|
39
|
|
|
|
|
1138
|
return $self->{'_in_fh'}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _assert_prefix_regex |
21
|
|
|
|
|
|
|
{ |
22
|
26
|
|
|
26
|
|
59
|
my $self = shift; |
23
|
26
|
100
|
|
|
|
75
|
if (@_) |
24
|
|
|
|
|
|
|
{ |
25
|
13
|
|
|
|
|
33
|
$self->{'_assert_prefix_regex'} = shift; |
26
|
|
|
|
|
|
|
} |
27
|
26
|
|
|
|
|
79
|
return $self->{'_assert_prefix_regex'}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _filename |
31
|
|
|
|
|
|
|
{ |
32
|
19
|
|
|
19
|
|
42
|
my $self = shift; |
33
|
19
|
100
|
|
|
|
63
|
if (@_) |
34
|
|
|
|
|
|
|
{ |
35
|
3
|
|
|
|
|
10
|
$self->{'_filename'} = shift; |
36
|
|
|
|
|
|
|
} |
37
|
19
|
|
|
|
|
237
|
return $self->{'_filename'}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _init |
41
|
|
|
|
|
|
|
{ |
42
|
13
|
|
|
13
|
|
27
|
my $self = shift; |
43
|
13
|
|
|
|
|
27
|
my $args = shift; |
44
|
|
|
|
|
|
|
|
45
|
13
|
|
|
|
|
24
|
my $in; |
46
|
|
|
|
|
|
|
|
47
|
13
|
100
|
|
|
|
48
|
if ( exists( $args->{'filename'} ) ) |
48
|
|
|
|
|
|
|
{ |
49
|
3
|
|
|
|
|
13
|
$self->_filename( $args->{'filename'} ); |
50
|
3
|
50
|
|
|
|
19
|
open $in, "<:raw", $self->_filename() |
51
|
|
|
|
|
|
|
or die "Could not open '" . $self->_filename() . "' - $!."; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else |
54
|
|
|
|
|
|
|
{ |
55
|
10
|
|
|
|
|
24
|
$in = $args->{'input_fh'}; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
13
|
|
|
|
|
60
|
$self->_in_fh($in); |
59
|
13
|
100
|
|
|
|
39
|
if ( exists( $args->{'assert_prefix_regex'} ) ) |
60
|
|
|
|
|
|
|
{ |
61
|
1
|
|
|
|
|
3
|
my $re = $args->{'assert_prefix_regex'}; |
62
|
1
|
50
|
|
|
|
7
|
$self->_assert_prefix_regex( ( ref($re) eq "" ) ? qr{$re} : $re ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else |
65
|
|
|
|
|
|
|
{ |
66
|
12
|
|
|
|
|
86
|
$self->_assert_prefix_regex(qr{# TEST}); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
13
|
|
|
|
|
34
|
return 0; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub process |
74
|
|
|
|
|
|
|
{ |
75
|
13
|
|
|
13
|
1
|
44
|
my $self = shift; |
76
|
13
|
|
|
|
|
26
|
my $args = shift; |
77
|
|
|
|
|
|
|
|
78
|
13
|
|
66
|
|
|
105
|
my $parser = $args->{parser} || Test::Count::Parser->new(); |
79
|
|
|
|
|
|
|
|
80
|
13
|
|
|
|
|
76
|
$parser->_push_current_filename( $self->_filename ); |
81
|
|
|
|
|
|
|
|
82
|
13
|
|
|
|
|
52
|
my $assert_re = $self->_assert_prefix_regex(); |
83
|
|
|
|
|
|
|
|
84
|
13
|
|
|
|
|
54
|
my @file_lines = readline( $self->_in_fh() ); |
85
|
13
|
|
|
|
|
3756
|
close( $self->_in_fh() ); |
86
|
|
|
|
|
|
|
|
87
|
13
|
|
|
|
|
151
|
foreach my $idx ( 0 .. $#file_lines ) |
88
|
|
|
|
|
|
|
{ |
89
|
453
|
|
|
|
|
213943
|
my $line = $file_lines[$idx]; |
90
|
|
|
|
|
|
|
|
91
|
453
|
|
|
|
|
674
|
chomp($line); |
92
|
453
|
100
|
|
|
|
2449
|
if ( $line =~ /${assert_re}:(.*)$/ ) |
|
|
100
|
|
|
|
|
|
93
|
|
|
|
|
|
|
{ |
94
|
28
|
|
|
|
|
177
|
$parser->update_assignments( |
95
|
|
|
|
|
|
|
{ |
96
|
|
|
|
|
|
|
'text' => $1, |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# The \s* is to handle trailing whitespace properly. |
102
|
|
|
|
|
|
|
elsif ( $line =~ /${assert_re}((?:[+*].*)?)\s*$/ ) |
103
|
|
|
|
|
|
|
{ |
104
|
40
|
|
|
|
|
120
|
my $s = $1; |
105
|
40
|
100
|
|
|
|
263
|
$parser->update_count( |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
'text' => ( ( $s eq "" ) ? 1 : substr( $s, 1 ) ), |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
13
|
|
|
|
|
104
|
$parser->_pop_current_filenames(); |
113
|
13
|
50
|
|
|
|
23
|
if ( @{ $parser->_parser->{filter_mults} } != 1 ) |
|
13
|
|
|
|
|
42
|
|
114
|
|
|
|
|
|
|
{ |
115
|
0
|
|
|
|
|
0
|
die "Unbalanced FILTER() and ENDFILTER()."; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
13
|
|
|
|
|
63
|
return { 'tests_count' => $parser->get_count(), 'lines' => \@file_lines, }; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; # End of Test::Count |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |