line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Prove::State::Result::Test; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
31
|
use strict; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
202
|
|
4
|
8
|
|
|
8
|
|
28
|
use warnings; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
1009
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
App::Prove::State::Result::Test - Individual test results. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 3.38 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '3.38'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The C command supports a C<--state> option that instructs it to |
21
|
|
|
|
|
|
|
store persistent state across runs. This module encapsulates the results for a |
22
|
|
|
|
|
|
|
single test. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Re-run failed tests |
27
|
|
|
|
|
|
|
$ prove --state=failed,save -rbv |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my %methods = ( |
32
|
|
|
|
|
|
|
name => { method => 'name' }, |
33
|
|
|
|
|
|
|
elapsed => { method => 'elapsed', default => 0 }, |
34
|
|
|
|
|
|
|
gen => { method => 'generation', default => 1 }, |
35
|
|
|
|
|
|
|
last_pass_time => { method => 'last_pass_time', default => undef }, |
36
|
|
|
|
|
|
|
last_fail_time => { method => 'last_fail_time', default => undef }, |
37
|
|
|
|
|
|
|
last_result => { method => 'result', default => 0 }, |
38
|
|
|
|
|
|
|
last_run_time => { method => 'run_time', default => undef }, |
39
|
|
|
|
|
|
|
last_todo => { method => 'num_todo', default => 0 }, |
40
|
|
|
|
|
|
|
mtime => { method => 'mtime', default => undef }, |
41
|
|
|
|
|
|
|
seq => { method => 'sequence', default => 1 }, |
42
|
|
|
|
|
|
|
total_passes => { method => 'total_passes', default => 0 }, |
43
|
|
|
|
|
|
|
total_failures => { method => 'total_failures', default => 0 }, |
44
|
|
|
|
|
|
|
parser => { method => 'parser' }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
while ( my ( $key, $description ) = each %methods ) { |
48
|
|
|
|
|
|
|
my $default = $description->{default}; |
49
|
8
|
|
|
8
|
|
38
|
no strict 'refs'; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
1575
|
|
50
|
|
|
|
|
|
|
*{ $description->{method} } = sub { |
51
|
575
|
|
|
575
|
|
476
|
my $self = shift; |
52
|
575
|
100
|
|
|
|
868
|
if (@_) { |
53
|
18
|
|
|
|
|
38
|
$self->{$key} = shift; |
54
|
18
|
|
|
|
|
28
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
557
|
|
66
|
|
|
1867
|
return $self->{$key} || $default; |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 Class Methods |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head3 C |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub new { |
69
|
93
|
|
|
93
|
1
|
112
|
my ( $class, $arg_for ) = @_; |
70
|
93
|
|
50
|
|
|
150
|
$arg_for ||= {}; |
71
|
93
|
|
|
|
|
453
|
bless $arg_for => $class; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 Instance Methods |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head3 C |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The name of the test. Usually a filename. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head3 C |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The total elapsed times the test took to run, in seconds from the epoch.. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head3 C |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
The number for the "generation" of the test run. The first generation is 1 |
87
|
|
|
|
|
|
|
(one) and subsequent generations are 2, 3, etc. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head3 C |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The last time the test program passed, in seconds from the epoch. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns C if the program has never passed. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head3 C |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
The last time the test suite failed, in seconds from the epoch. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Returns C if the program has never failed. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head3 C |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns the mtime of the test, in seconds from the epoch. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head3 C |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Returns a hashref of raw test data, suitable for serialization by YAML. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head3 C |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Currently, whether or not the test suite passed with no 'problems' (such as |
112
|
|
|
|
|
|
|
TODO passed). |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head3 C |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The total time it took for the test to run, in seconds. If C is |
117
|
|
|
|
|
|
|
available, it will have finer granularity. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head3 C |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The number of tests with TODO directives. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head3 C |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
The order in which this test was run for the given test suite result. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head3 C |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The number of times the test has passed. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head3 C |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The number of times the test has failed. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head3 C |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The underlying parser object. This is useful if you need the full |
138
|
|
|
|
|
|
|
information for the test program. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub raw { |
143
|
6
|
|
|
6
|
1
|
6
|
my $self = shift; |
144
|
6
|
|
|
|
|
25
|
my %raw = %$self; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# this is backwards-compatibility hack and is not guaranteed. |
147
|
6
|
|
|
|
|
6
|
delete $raw{name}; |
148
|
6
|
|
|
|
|
5
|
delete $raw{parser}; |
149
|
6
|
|
|
|
|
8
|
return \%raw; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |