| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package TAP::Formatter::Pretty::Single::Session; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
46
|
|
|
4
|
2
|
|
|
2
|
|
1553
|
use TAP::Formatter::Session; |
|
|
2
|
|
|
|
|
2108
|
|
|
|
2
|
|
|
|
|
51
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use parent qw(TAP::Formatter::Session); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my @ACCESSOR; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
|
11
|
2
|
|
|
2
|
|
5
|
my @CLOSURE_BINDING = qw( header result clear_for_close close_test ); |
|
12
|
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
3
|
for my $method (@CLOSURE_BINDING) { |
|
14
|
2
|
|
|
2
|
|
138
|
no strict 'refs'; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
130
|
|
|
15
|
|
|
|
|
|
|
*$method = sub { |
|
16
|
8
|
|
|
8
|
|
155067
|
my $self = shift; |
|
17
|
8
|
|
66
|
|
|
95
|
return ( $self->{_closures} ||= $self->_closures )->{$method} |
|
18
|
|
|
|
|
|
|
->(@_); |
|
19
|
8
|
|
|
|
|
1674
|
}; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _get_output_result { |
|
24
|
2
|
|
|
2
|
|
6
|
my $self = shift; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my @color_map = ( |
|
27
|
0
|
0
|
|
0
|
|
0
|
{ test => sub { $_->is_test && !$_->is_ok }, |
|
28
|
|
|
|
|
|
|
colors => ['red'], |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
0
|
0
|
|
0
|
|
0
|
{ test => sub { $_->is_test && $_->has_skip }, |
|
31
|
|
|
|
|
|
|
colors => [ |
|
32
|
|
|
|
|
|
|
'white', |
|
33
|
|
|
|
|
|
|
'on_blue' |
|
34
|
|
|
|
|
|
|
], |
|
35
|
|
|
|
|
|
|
}, |
|
36
|
0
|
0
|
|
0
|
|
0
|
{ test => sub { $_->is_test && $_->has_todo }, |
|
37
|
2
|
|
|
|
|
97
|
colors => ['yellow'], |
|
38
|
|
|
|
|
|
|
}, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
23
|
my $formatter = $self->formatter; |
|
42
|
2
|
|
|
|
|
25
|
my $parser = $self->parser; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return $formatter->_colorizer |
|
45
|
|
|
|
|
|
|
? sub { |
|
46
|
0
|
|
|
0
|
|
0
|
my $result = shift; |
|
47
|
0
|
|
|
|
|
0
|
for my $col (@color_map) { |
|
48
|
0
|
|
|
|
|
0
|
local $_ = $result; |
|
49
|
0
|
0
|
|
|
|
0
|
if ( $col->{test}->() ) { |
|
50
|
0
|
|
|
|
|
0
|
last; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
0
|
|
|
|
|
0
|
$formatter->_output( $self->_format_for_output($result) ); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
: sub { |
|
56
|
0
|
|
|
0
|
|
0
|
$formatter->_output( $self->_format_for_output(shift) ); |
|
57
|
2
|
50
|
|
|
|
35
|
}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _closures { |
|
61
|
2
|
|
|
2
|
|
11
|
my $self = shift; |
|
62
|
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
68
|
my $parser = $self->parser; |
|
64
|
2
|
|
|
|
|
30
|
my $formatter = $self->formatter; |
|
65
|
2
|
|
|
|
|
36
|
my $pretty = $formatter->_format_name( $self->name ); |
|
66
|
2
|
|
|
|
|
138
|
my $show_count = $self->show_count; |
|
67
|
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
42
|
my $really_quiet = $formatter->really_quiet; |
|
69
|
2
|
|
|
|
|
55
|
my $quiet = $formatter->quiet; |
|
70
|
2
|
|
|
|
|
33
|
my $verbose = $formatter->verbose; |
|
71
|
2
|
|
|
|
|
59
|
my $directives = $formatter->directives; |
|
72
|
2
|
|
|
|
|
44
|
my $failures = $formatter->failures; |
|
73
|
2
|
|
|
|
|
35
|
my $comments = $formatter->comments; |
|
74
|
|
|
|
|
|
|
|
|
75
|
2
|
|
|
|
|
22
|
my $output_result = $self->_get_output_result; |
|
76
|
|
|
|
|
|
|
|
|
77
|
2
|
|
|
|
|
77
|
my $output = '_output'; |
|
78
|
2
|
|
|
|
|
13
|
my $plan = ''; |
|
79
|
2
|
|
|
|
|
12
|
my $newline_printed = 0; |
|
80
|
|
|
|
|
|
|
|
|
81
|
2
|
|
|
|
|
7
|
my $last_status_printed = 0; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return { |
|
84
|
|
|
|
0
|
|
|
header => sub { }, |
|
85
|
|
|
|
|
|
|
result => sub { |
|
86
|
6
|
|
|
6
|
|
12
|
my $result = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
6
|
50
|
|
|
|
57
|
if ( $result->is_bailout ) { |
|
89
|
0
|
|
|
|
|
0
|
$formatter->_failure_output( |
|
90
|
|
|
|
|
|
|
"Bailout called. Further testing stopped: " |
|
91
|
|
|
|
|
|
|
. $result->explanation |
|
92
|
|
|
|
|
|
|
. "\n" ); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
6
|
50
|
|
|
|
87
|
return if $really_quiet; |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
0
|
my $is_test = $result->is_test; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# These are used in close_test - but only if $really_quiet |
|
100
|
|
|
|
|
|
|
# is false - so it's safe to only set them here unless that |
|
101
|
|
|
|
|
|
|
# relationship changes. |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
0
|
if ( !$plan ) { |
|
104
|
0
|
|
0
|
|
|
0
|
my $planned = $parser->tests_planned || '?'; |
|
105
|
0
|
|
|
|
|
0
|
$plan = "/$planned "; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
0
|
|
|
|
|
0
|
$output = $formatter->_get_output_method($parser); |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
0
|
0
|
|
|
0
|
if ( $show_count and $is_test ) { |
|
110
|
0
|
|
|
|
|
0
|
my $number = $result->number; |
|
111
|
0
|
|
|
|
|
0
|
my $now = CORE::time; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Print status roughly once per second. |
|
114
|
|
|
|
|
|
|
# We will always get the first number as a side effect of |
|
115
|
|
|
|
|
|
|
# $last_status_printed starting with the value 0, which $now |
|
116
|
|
|
|
|
|
|
# will never be. (Unless someone sets their clock to 1970) |
|
117
|
0
|
0
|
|
|
|
0
|
if ( $last_status_printed != $now ) { |
|
118
|
0
|
|
|
|
|
0
|
$formatter->$output("\r$pretty$number$plan"); |
|
119
|
0
|
|
|
|
|
0
|
$last_status_printed = $now; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
0
|
0
|
|
|
0
|
if (!$quiet |
|
|
|
|
0
|
|
|
|
|
|
124
|
|
|
|
|
|
|
&& ( $verbose |
|
125
|
|
|
|
|
|
|
|| ( $is_test && $failures && !$result->is_ok ) |
|
126
|
|
|
|
|
|
|
|| ( $comments && $result->is_comment ) |
|
127
|
|
|
|
|
|
|
|| ( $directives && $result->has_directive ) ) |
|
128
|
|
|
|
|
|
|
) |
|
129
|
|
|
|
|
|
|
{ |
|
130
|
0
|
0
|
|
|
|
0
|
unless ($newline_printed) { |
|
131
|
0
|
|
|
|
|
0
|
$formatter->_output("\n"); |
|
132
|
0
|
|
|
|
|
0
|
$newline_printed = 1; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
0
|
|
|
|
|
0
|
$output_result->($result); |
|
135
|
0
|
|
|
|
|
0
|
$formatter->_output("\n"); |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
}, |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
0
|
|
|
clear_for_close => sub { }, |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
close_test => sub { |
|
142
|
2
|
50
|
33
|
2
|
|
18
|
if ( $show_count && !$really_quiet ) { |
|
143
|
0
|
|
|
|
|
0
|
$self->clear_for_close; |
|
144
|
0
|
|
|
|
|
0
|
$formatter->$output("\r$pretty"); |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
# Avoid circular references |
|
148
|
2
|
|
|
|
|
19
|
$self->parser(undef); |
|
149
|
2
|
|
|
|
|
17
|
$self->{_closures} = {}; |
|
150
|
|
|
|
|
|
|
|
|
151
|
2
|
50
|
|
|
|
95
|
return if $really_quiet; |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
0
|
|
|
|
|
if ( my $skip_all = $parser->skip_all ) { |
|
|
|
0
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
$formatter->_output("skipped: $skip_all\n"); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
elsif ( $parser->has_problems ) { |
|
157
|
0
|
|
|
|
|
|
$self->_output_test_failure($parser); |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
else { |
|
160
|
0
|
|
|
|
|
|
my $time_report = ''; |
|
161
|
0
|
0
|
|
|
|
|
if ( $formatter->timer ) { |
|
162
|
0
|
|
|
|
|
|
my $start_time = $parser->start_time; |
|
163
|
0
|
|
|
|
|
|
my $end_time = $parser->end_time; |
|
164
|
0
|
0
|
0
|
|
|
|
if ( defined $start_time and defined $end_time ) { |
|
165
|
0
|
|
|
|
|
|
my $elapsed = $end_time - $start_time; |
|
166
|
0
|
0
|
0
|
|
|
|
$time_report |
|
167
|
|
|
|
|
|
|
= $self->time_is_hires |
|
168
|
|
|
|
|
|
|
? sprintf( ' %8d ms', $elapsed * 1000 ) |
|
169
|
|
|
|
|
|
|
: sprintf( ' %8s s', $elapsed || '<1' ); |
|
170
|
|
|
|
|
|
|
} |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
} |
|
173
|
|
|
|
|
|
|
}, |
|
174
|
2
|
|
|
|
|
95
|
}; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
1; |