line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: cperl; cperl-indent-level: 4 -*- |
2
|
|
|
|
|
|
|
package Test::Harness::Point; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1152
|
|
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 = Test::Harness::Point->new; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Create a test point object. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
48543
|
|
|
48543
|
1
|
63439
|
my $class = shift; |
28
|
48543
|
|
|
|
|
86198
|
my $self = bless {}, $class; |
29
|
|
|
|
|
|
|
|
30
|
48543
|
|
|
|
|
87273
|
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
|
64829
|
|
|
64829
|
0
|
74852
|
my $class = shift; |
42
|
64829
|
50
|
|
|
|
104772
|
my $line = shift or return; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# We pulverize the line down into pieces in three parts. |
45
|
64829
|
100
|
|
|
|
496259
|
my ($not, $number, $extra) = ($line =~ /^(not )?ok\b(?:\s+(\d+))?\s*(.*)/) or return; |
46
|
|
|
|
|
|
|
|
47
|
48543
|
|
|
|
|
126649
|
my $point = $class->new; |
48
|
48543
|
|
|
|
|
97707
|
$point->set_number( $number ); |
49
|
48543
|
|
|
|
|
94234
|
$point->set_ok( !$not ); |
50
|
|
|
|
|
|
|
|
51
|
48543
|
100
|
|
|
|
83871
|
if ( $extra ) { |
52
|
20790
|
|
|
|
|
67738
|
my ($description,$directive) = split( /(?:[^\\]|^)#/, $extra, 2 ); |
53
|
20790
|
|
|
|
|
83710
|
$description =~ s/^- //; # Test::More puts it in there |
54
|
20790
|
|
|
|
|
47703
|
$point->set_description( $description ); |
55
|
20790
|
100
|
|
|
|
42465
|
if ( $directive ) { |
56
|
560
|
|
|
|
|
868
|
$point->set_directive( $directive ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} # if $extra |
59
|
|
|
|
|
|
|
|
60
|
48543
|
|
|
|
|
87891
|
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
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
145629
|
|
|
145629
|
1
|
150755
|
sub ok { my $self = shift; $self->{ok} } |
|
145629
|
|
|
|
|
348390
|
|
78
|
|
|
|
|
|
|
sub set_ok { |
79
|
48543
|
|
|
48543
|
0
|
63818
|
my $self = shift; |
80
|
48543
|
|
|
|
|
58587
|
my $ok = shift; |
81
|
48543
|
50
|
|
|
|
94290
|
$self->{ok} = $ok ? 1 : 0; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
sub pass { |
84
|
97086
|
|
|
97086
|
0
|
107050
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
97086
|
50
|
33
|
|
|
124576
|
return ($self->ok || $self->is_todo || $self->is_skip) ? 1 : 0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
242715
|
|
|
242715
|
1
|
267174
|
sub number { my $self = shift; $self->{number} } |
|
242715
|
|
|
|
|
716012
|
|
90
|
48543
|
|
|
48543
|
0
|
51754
|
sub set_number { my $self = shift; $self->{number} = shift } |
|
48543
|
|
|
|
|
106594
|
|
91
|
|
|
|
|
|
|
|
92
|
48543
|
|
|
48543
|
0
|
52732
|
sub description { my $self = shift; $self->{description} } |
|
48543
|
|
|
|
|
100134
|
|
93
|
|
|
|
|
|
|
sub set_description { |
94
|
20790
|
|
|
20790
|
0
|
23747
|
my $self = shift; |
95
|
20790
|
|
|
|
|
30274
|
$self->{description} = shift; |
96
|
20790
|
|
|
|
|
35563
|
$self->{name} = $self->{description}; # history |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
0
|
0
|
sub directive { my $self = shift; $self->{directive} } |
|
0
|
|
|
|
|
0
|
|
100
|
|
|
|
|
|
|
sub set_directive { |
101
|
560
|
|
|
560
|
0
|
624
|
my $self = shift; |
102
|
560
|
|
|
|
|
625
|
my $directive = shift; |
103
|
|
|
|
|
|
|
|
104
|
560
|
|
|
|
|
1685
|
$directive =~ s/^\s+//; |
105
|
560
|
|
|
|
|
1464
|
$directive =~ s/\s+$//; |
106
|
560
|
|
|
|
|
882
|
$self->{directive} = $directive; |
107
|
|
|
|
|
|
|
|
108
|
560
|
|
|
|
|
2069
|
my ($type,$reason) = ($directive =~ /^\s*(\S+)(?:\s+(.*))?$/); |
109
|
560
|
|
|
|
|
1327
|
$self->set_directive_type( $type ); |
110
|
560
|
50
|
|
|
|
1045
|
$reason = "" unless defined $reason; |
111
|
560
|
|
|
|
|
1423
|
$self->{directive_reason} = $reason; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
sub set_directive_type { |
114
|
560
|
|
|
560
|
0
|
639
|
my $self = shift; |
115
|
560
|
|
|
|
|
1005
|
$self->{directive_type} = lc shift; |
116
|
560
|
|
|
|
|
944
|
$self->{type} = $self->{directive_type}; # History |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
sub set_directive_reason { |
119
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
120
|
0
|
|
|
|
|
0
|
$self->{directive_reason} = shift; |
121
|
|
|
|
|
|
|
} |
122
|
145629
|
|
|
145629
|
0
|
158510
|
sub directive_type { my $self = shift; $self->{directive_type} } |
|
145629
|
|
|
|
|
194863
|
|
123
|
0
|
|
|
0
|
0
|
0
|
sub type { my $self = shift; $self->{directive_type} } |
|
0
|
|
|
|
|
0
|
|
124
|
48543
|
|
|
48543
|
0
|
58524
|
sub directive_reason{ my $self = shift; $self->{directive_reason} } |
|
48543
|
|
|
|
|
79929
|
|
125
|
0
|
|
|
0
|
0
|
0
|
sub reason { my $self = shift; $self->{directive_reason} } |
|
0
|
|
|
|
|
0
|
|
126
|
|
|
|
|
|
|
sub is_todo { |
127
|
48543
|
|
|
48543
|
0
|
61575
|
my $self = shift; |
128
|
48543
|
|
|
|
|
67761
|
my $type = $self->directive_type; |
129
|
48543
|
|
66
|
|
|
152014
|
return $type && ( $type eq 'todo' ); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
sub is_skip { |
132
|
48543
|
|
|
48543
|
0
|
59159
|
my $self = shift; |
133
|
48543
|
|
|
|
|
61427
|
my $type = $self->directive_type; |
134
|
48543
|
|
66
|
|
|
118949
|
return $type && ( $type eq 'skip' ); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub diagnostics { |
138
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
139
|
0
|
0
|
|
|
|
|
return @{$self->{diagnostics}} if wantarray; |
|
0
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
return join( "\n", @{$self->{diagnostics}} ); |
|
0
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
} |
142
|
0
|
|
|
0
|
0
|
|
sub add_diagnostic { my $self = shift; push @{$self->{diagnostics}}, @_ } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
1; |