line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: cperl; cperl-indent-level: 4 -*- |
2
|
|
|
|
|
|
|
package Test::Harness::Point; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
970
|
|
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
|
63495
|
my $class = shift; |
28
|
48543
|
|
|
|
|
99789
|
my $self = bless {}, $class; |
29
|
|
|
|
|
|
|
|
30
|
48543
|
|
|
|
|
90330
|
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
|
64823
|
|
|
64823
|
0
|
77861
|
my $class = shift; |
42
|
64823
|
50
|
|
|
|
107380
|
my $line = shift or return; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# We pulverize the line down into pieces in three parts. |
45
|
64823
|
100
|
|
|
|
504862
|
my ($not, $number, $extra) = ($line =~ /^(not )?ok\b(?:\s+(\d+))?\s*(.*)/) or return; |
46
|
|
|
|
|
|
|
|
47
|
48543
|
|
|
|
|
119746
|
my $point = $class->new; |
48
|
48543
|
|
|
|
|
108503
|
$point->set_number( $number ); |
49
|
48543
|
|
|
|
|
109937
|
$point->set_ok( !$not ); |
50
|
|
|
|
|
|
|
|
51
|
48543
|
100
|
|
|
|
83609
|
if ( $extra ) { |
52
|
20790
|
|
|
|
|
75448
|
my ($description,$directive) = split( /(?:[^\\]|^)#/, $extra, 2 ); |
53
|
20790
|
|
|
|
|
89636
|
$description =~ s/^- //; # Test::More puts it in there |
54
|
20790
|
|
|
|
|
50124
|
$point->set_description( $description ); |
55
|
20790
|
100
|
|
|
|
42487
|
if ( $directive ) { |
56
|
560
|
|
|
|
|
958
|
$point->set_directive( $directive ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} # if $extra |
59
|
|
|
|
|
|
|
|
60
|
48543
|
|
|
|
|
90402
|
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
|
156096
|
sub ok { my $self = shift; $self->{ok} } |
|
145629
|
|
|
|
|
364906
|
|
78
|
|
|
|
|
|
|
sub set_ok { |
79
|
48543
|
|
|
48543
|
0
|
54197
|
my $self = shift; |
80
|
48543
|
|
|
|
|
58937
|
my $ok = shift; |
81
|
48543
|
50
|
|
|
|
101598
|
$self->{ok} = $ok ? 1 : 0; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
sub pass { |
84
|
97086
|
|
|
97086
|
0
|
110646
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
97086
|
50
|
33
|
|
|
124561
|
return ($self->ok || $self->is_todo || $self->is_skip) ? 1 : 0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
242715
|
|
|
242715
|
1
|
276643
|
sub number { my $self = shift; $self->{number} } |
|
242715
|
|
|
|
|
748985
|
|
90
|
48543
|
|
|
48543
|
0
|
55633
|
sub set_number { my $self = shift; $self->{number} = shift } |
|
48543
|
|
|
|
|
111524
|
|
91
|
|
|
|
|
|
|
|
92
|
48543
|
|
|
48543
|
0
|
55229
|
sub description { my $self = shift; $self->{description} } |
|
48543
|
|
|
|
|
104125
|
|
93
|
|
|
|
|
|
|
sub set_description { |
94
|
20790
|
|
|
20790
|
0
|
23868
|
my $self = shift; |
95
|
20790
|
|
|
|
|
37712
|
$self->{description} = shift; |
96
|
20790
|
|
|
|
|
39812
|
$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
|
622
|
my $self = shift; |
102
|
560
|
|
|
|
|
664
|
my $directive = shift; |
103
|
|
|
|
|
|
|
|
104
|
560
|
|
|
|
|
1785
|
$directive =~ s/^\s+//; |
105
|
560
|
|
|
|
|
1290
|
$directive =~ s/\s+$//; |
106
|
560
|
|
|
|
|
1003
|
$self->{directive} = $directive; |
107
|
|
|
|
|
|
|
|
108
|
560
|
|
|
|
|
2142
|
my ($type,$reason) = ($directive =~ /^\s*(\S+)(?:\s+(.*))?$/); |
109
|
560
|
|
|
|
|
1257
|
$self->set_directive_type( $type ); |
110
|
560
|
50
|
|
|
|
1061
|
$reason = "" unless defined $reason; |
111
|
560
|
|
|
|
|
1414
|
$self->{directive_reason} = $reason; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
sub set_directive_type { |
114
|
560
|
|
|
560
|
0
|
638
|
my $self = shift; |
115
|
560
|
|
|
|
|
1124
|
$self->{directive_type} = lc shift; |
116
|
560
|
|
|
|
|
1071
|
$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
|
161074
|
sub directive_type { my $self = shift; $self->{directive_type} } |
|
145629
|
|
|
|
|
212648
|
|
123
|
0
|
|
|
0
|
0
|
0
|
sub type { my $self = shift; $self->{directive_type} } |
|
0
|
|
|
|
|
0
|
|
124
|
48543
|
|
|
48543
|
0
|
57972
|
sub directive_reason{ my $self = shift; $self->{directive_reason} } |
|
48543
|
|
|
|
|
80489
|
|
125
|
0
|
|
|
0
|
0
|
0
|
sub reason { my $self = shift; $self->{directive_reason} } |
|
0
|
|
|
|
|
0
|
|
126
|
|
|
|
|
|
|
sub is_todo { |
127
|
48543
|
|
|
48543
|
0
|
59105
|
my $self = shift; |
128
|
48543
|
|
|
|
|
76201
|
my $type = $self->directive_type; |
129
|
48543
|
|
66
|
|
|
164391
|
return $type && ( $type eq 'todo' ); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
sub is_skip { |
132
|
48543
|
|
|
48543
|
0
|
57309
|
my $self = shift; |
133
|
48543
|
|
|
|
|
64861
|
my $type = $self->directive_type; |
134
|
48543
|
|
66
|
|
|
116148
|
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; |