line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Run::Plugin::ColorSummary; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1361378
|
use warnings; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
77
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
54
|
use 5.008; |
|
2
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
672
|
use Moose; |
|
2
|
|
|
|
|
483180
|
|
|
2
|
|
|
|
|
15
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
14567
|
use MRO::Compat; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
38
|
|
11
|
2
|
|
|
2
|
|
1713
|
use Term::ANSIColor qw/ color /; |
|
2
|
|
|
|
|
18642
|
|
|
2
|
|
|
|
|
1596
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Needed for ->autoflush() |
14
|
2
|
|
|
2
|
|
646
|
use IO::Handle; |
|
2
|
|
|
|
|
6680
|
|
|
2
|
|
|
|
|
733
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends('Test::Run::Base'); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Test::Run::Plugin::ColorSummary - A Test::Run plugin that |
21
|
|
|
|
|
|
|
colors the summary. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 VERSION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
0.0203 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = '0.0203'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'summary_color_failure' => ( is => "rw", isa => "Str" ); |
32
|
|
|
|
|
|
|
has 'summary_color_success' => ( is => "rw", isa => "Str" ); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _get_failure_summary_color |
35
|
|
|
|
|
|
|
{ |
36
|
2
|
|
|
2
|
|
7
|
my $self = shift; |
37
|
2
|
|
66
|
|
|
99
|
return $self->summary_color_failure() |
38
|
|
|
|
|
|
|
|| $self->_get_default_failure_summary_color(); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _get_default_failure_summary_color |
42
|
|
|
|
|
|
|
{ |
43
|
1
|
|
|
1
|
|
20
|
return "bold red"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _get_success_summary_color |
47
|
|
|
|
|
|
|
{ |
48
|
2
|
|
|
2
|
|
7
|
my $self = shift; |
49
|
2
|
|
66
|
|
|
110
|
return $self->summary_color_success() |
50
|
|
|
|
|
|
|
|| $self->_get_default_success_summary_color(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _get_default_success_summary_color |
54
|
|
|
|
|
|
|
{ |
55
|
1
|
|
|
1
|
|
23
|
return "bold blue"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SYNOPSIS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
package MyTestRun; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
use vars qw(@ISA); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
@ISA = (qw(Test::Run::Plugin::ColorSummary Test::Run::Obj)); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $tester = MyTestRun->new( |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
test_files => |
69
|
|
|
|
|
|
|
[ |
70
|
|
|
|
|
|
|
"t/sample-tests/one-ok.t", |
71
|
|
|
|
|
|
|
"t/sample-tests/several-oks.t" |
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$tester->runtests(); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 EXTRA PARAMETERS TO NEW |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
We accept two new named parameters to the new constructor: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 summary_color_success |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is the color string for coloring the success line. The string itself |
85
|
|
|
|
|
|
|
conforms to the one specified in L<Term::ANSIColor>. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 summary_color_failure |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This is the color string for coloring the summary line in case of |
90
|
|
|
|
|
|
|
failure. The string itself conforms to the one specified |
91
|
|
|
|
|
|
|
in L<Term::ANSIColor>. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 FUNCTIONS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _report_success |
98
|
|
|
|
|
|
|
{ |
99
|
2
|
|
|
2
|
|
707000
|
my $self = shift; |
100
|
2
|
|
|
|
|
149
|
print color( $self->_get_success_summary_color() ); |
101
|
2
|
|
|
|
|
188
|
$self->next::method(); |
102
|
2
|
|
|
|
|
1102
|
print color("reset"); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 $tester->_handle_runtests_error() |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
We override _handle_runtests_error() to colour the errors in red. The rest of |
108
|
|
|
|
|
|
|
the documentation is the code. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _handle_runtests_error_text |
113
|
|
|
|
|
|
|
{ |
114
|
2
|
|
|
2
|
|
470437
|
my ( $self, $args ) = @_; |
115
|
|
|
|
|
|
|
|
116
|
2
|
|
|
|
|
13
|
my $text = $args->{'text'}; |
117
|
|
|
|
|
|
|
|
118
|
2
|
|
|
|
|
32
|
STDERR->autoflush(); |
119
|
2
|
|
|
|
|
230
|
$text =~ s{\n\z}{}; |
120
|
2
|
|
|
|
|
28
|
die color( $self->_get_failure_summary_color() ) |
121
|
|
|
|
|
|
|
. $text |
122
|
|
|
|
|
|
|
. color("reset") . "\n"; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Shlomi Fish, L<http://www.shlomifish.org/> . |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 BUGS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
134
|
|
|
|
|
|
|
C<bug-test-run-plugin-colorsummary@rt.cpan.org>, or through the web interface at |
135
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Run-Plugin-ColorSummary>. |
136
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
137
|
|
|
|
|
|
|
your bug as I make changes. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 SUPPORT |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
perldoc Test::Run::Plugin::ColorSummary |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
You can also look for information at: |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=over 4 |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item * CPAN Ratings |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Test::Run::Plugin::ColorSummary> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test::Run::Plugin::ColorSummary> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * Search CPAN |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Test::Run::Plugin::ColorSummary/> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=back |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 SOURCE AVAILABILITY |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
The latest source of Test::Run::Plugin::ColorSummary is available from the |
166
|
|
|
|
|
|
|
Test::Run BerliOS Subversion repository: |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
L<https://svn.berlios.de/svnroot/repos/web-cpan/Test-Harness-NG/> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 SEE ALSO |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
L<Test::Run::Obj>, L<Term::ANSIColor>, |
173
|
|
|
|
|
|
|
L<Test::Run::CmdLine::Plugin::ColorSummary>. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
Copyright 2005 Shlomi Fish, all rights reserved. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This program is released under the MIT X11 License. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=cut |
184
|
|
|
|
|
|
|
|