| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- Mode: cperl; cperl-indent-level: 4 -*- |
|
2
|
|
|
|
|
|
|
package Test::Harness::Point; |
|
3
|
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
44253
|
use strict; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
196
|
|
|
5
|
6
|
|
|
6
|
|
28
|
use vars qw($VERSION); |
|
|
6
|
|
|
|
|
22
|
|
|
|
6
|
|
|
|
|
5970
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::Harness::Point - object for tracking a single test point |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
One Test::Harness::Point object represents a single test point. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 CONSTRUCTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 new() |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $point = new Test::Harness::Point; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Create a test point object. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
|
27
|
184
|
|
|
184
|
1
|
325
|
my $class = shift; |
|
28
|
184
|
|
|
|
|
2560
|
my $self = bless {}, $class; |
|
29
|
|
|
|
|
|
|
|
|
30
|
184
|
|
|
|
|
544
|
return $self; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 from_test_line( $line ) |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Constructor from a TAP test line, or empty return if the test line |
|
36
|
|
|
|
|
|
|
is not a test line. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub from_test_line { |
|
41
|
252
|
|
|
252
|
0
|
7475
|
my $class = shift; |
|
42
|
252
|
50
|
|
|
|
872
|
my $line = shift or return; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# We pulverize the line down into pieces in three parts. |
|
45
|
252
|
100
|
|
|
|
2494
|
my ($not, $number, $extra) = ($line =~ /^(not )?ok\b(?:\s+(\d+))?\s*(.*)/) or return; |
|
46
|
|
|
|
|
|
|
|
|
47
|
183
|
|
|
|
|
1026
|
my $point = $class->new; |
|
48
|
183
|
|
|
|
|
622
|
$point->set_number( $number ); |
|
49
|
183
|
|
|
|
|
484
|
$point->set_ok( !$not ); |
|
50
|
|
|
|
|
|
|
|
|
51
|
183
|
100
|
|
|
|
474
|
if ( $extra ) { |
|
52
|
51
|
|
|
|
|
447
|
my ($description,$directive) = split( /(?:[^\\]|^)#/, $extra, 2 ); |
|
53
|
51
|
|
|
|
|
209
|
$description =~ s/^- //; # Test::More puts it in there |
|
54
|
51
|
|
|
|
|
186
|
$point->set_description( $description ); |
|
55
|
51
|
100
|
|
|
|
152
|
if ( $directive ) { |
|
56
|
17
|
|
|
|
|
65
|
$point->set_directive( $directive ); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
} # if $extra |
|
59
|
|
|
|
|
|
|
|
|
60
|
183
|
|
|
|
|
504
|
return $point; |
|
61
|
|
|
|
|
|
|
} # from_test_line() |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Each of the following fields has a getter and setter method. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * ok |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * number |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
540
|
|
|
540
|
1
|
8754
|
sub ok { my $self = shift; $self->{ok} } |
|
|
540
|
|
|
|
|
3399
|
|
|
76
|
|
|
|
|
|
|
sub set_ok { |
|
77
|
187
|
|
|
187
|
0
|
623
|
my $self = shift; |
|
78
|
187
|
|
|
|
|
300
|
my $ok = shift; |
|
79
|
187
|
100
|
|
|
|
695
|
$self->{ok} = $ok ? 1 : 0; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
sub pass { |
|
82
|
338
|
|
|
338
|
0
|
691
|
my $self = shift; |
|
83
|
|
|
|
|
|
|
|
|
84
|
338
|
100
|
66
|
|
|
8219
|
return ($self->ok || $self->is_todo || $self->is_skip) ? 1 : 0; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
861
|
|
|
861
|
1
|
5991
|
sub number { my $self = shift; $self->{number} } |
|
|
861
|
|
|
|
|
4879
|
|
|
88
|
191
|
|
|
191
|
0
|
253
|
sub set_number { my $self = shift; $self->{number} = shift } |
|
|
191
|
|
|
|
|
678
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
174
|
|
|
174
|
0
|
2820
|
sub description { my $self = shift; $self->{description} } |
|
|
174
|
|
|
|
|
1094
|
|
|
91
|
|
|
|
|
|
|
sub set_description { |
|
92
|
52
|
|
|
52
|
0
|
98
|
my $self = shift; |
|
93
|
52
|
|
|
|
|
146
|
$self->{description} = shift; |
|
94
|
52
|
|
|
|
|
169
|
$self->{name} = $self->{description}; # history |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
1
|
|
|
1
|
0
|
2
|
sub directive { my $self = shift; $self->{directive} } |
|
|
1
|
|
|
|
|
7
|
|
|
98
|
|
|
|
|
|
|
sub set_directive { |
|
99
|
18
|
|
|
18
|
0
|
35
|
my $self = shift; |
|
100
|
18
|
|
|
|
|
30
|
my $directive = shift; |
|
101
|
|
|
|
|
|
|
|
|
102
|
18
|
|
|
|
|
205
|
$directive =~ s/^\s+//; |
|
103
|
18
|
|
|
|
|
82
|
$directive =~ s/\s+$//; |
|
104
|
18
|
|
|
|
|
65
|
$self->{directive} = $directive; |
|
105
|
|
|
|
|
|
|
|
|
106
|
18
|
|
|
|
|
145
|
my ($type,$reason) = ($directive =~ /^\s*(\S+)(?:\s+(.*))?$/); |
|
107
|
18
|
|
|
|
|
66
|
$self->set_directive_type( $type ); |
|
108
|
18
|
100
|
|
|
|
142
|
$reason = "" unless defined $reason; |
|
109
|
18
|
|
|
|
|
109
|
$self->{directive_reason} = $reason; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
sub set_directive_type { |
|
112
|
34
|
|
|
34
|
0
|
51
|
my $self = shift; |
|
113
|
34
|
|
|
|
|
164
|
$self->{directive_type} = lc shift; |
|
114
|
34
|
|
|
|
|
120
|
$self->{type} = $self->{directive_type}; # History |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
sub set_directive_reason { |
|
117
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
118
|
0
|
|
|
|
|
0
|
$self->{directive_reason} = shift; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
560
|
|
|
560
|
0
|
700
|
sub directive_type { my $self = shift; $self->{directive_type} } |
|
|
560
|
|
|
|
|
1474
|
|
|
121
|
5
|
|
|
5
|
0
|
2905
|
sub type { my $self = shift; $self->{directive_type} } |
|
|
5
|
|
|
|
|
47
|
|
|
122
|
168
|
|
|
168
|
0
|
215
|
sub directive_reason{ my $self = shift; $self->{directive_reason} } |
|
|
168
|
|
|
|
|
487
|
|
|
123
|
4
|
|
|
4
|
0
|
2405
|
sub reason { my $self = shift; $self->{directive_reason} } |
|
|
4
|
|
|
|
|
42
|
|
|
124
|
|
|
|
|
|
|
sub is_todo { |
|
125
|
214
|
|
|
214
|
0
|
353
|
my $self = shift; |
|
126
|
214
|
|
|
|
|
899
|
my $type = $self->directive_type; |
|
127
|
214
|
|
100
|
|
|
5237
|
return $type && ( $type eq 'todo' ); |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
sub is_skip { |
|
130
|
178
|
|
|
178
|
0
|
412
|
my $self = shift; |
|
131
|
178
|
|
|
|
|
603
|
my $type = $self->directive_type; |
|
132
|
178
|
|
66
|
|
|
882
|
return $type && ( $type eq 'skip' ); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub diagnostics { |
|
136
|
2
|
|
|
2
|
0
|
1420
|
my $self = shift; |
|
137
|
2
|
100
|
|
|
|
7
|
return @{$self->{diagnostics}} if wantarray; |
|
|
1
|
|
|
|
|
22
|
|
|
138
|
1
|
|
|
|
|
3
|
return join( "\n", @{$self->{diagnostics}} ); |
|
|
1
|
|
|
|
|
6
|
|
|
139
|
|
|
|
|
|
|
} |
|
140
|
3
|
|
|
3
|
0
|
5
|
sub add_diagnostic { my $self = shift; push @{$self->{diagnostics}}, @_ } |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
10
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; |