line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Shiras::Report::Test2Diag; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JANDREW'; |
3
|
1
|
|
|
1
|
|
548
|
use version; our $VERSION = version->declare("v0.44.0"); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
91
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
5
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
16
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
4148
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
8
|
1
|
|
|
1
|
|
59
|
use MooseX::StrictConstructor; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
9
|
1
|
|
|
1
|
|
1891
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
10
|
1
|
|
|
1
|
|
5
|
use Test2::Tools::Basic; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
115
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#########1 Public Methods 3#########4#########5#########6#########7#########8#########9 |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
sub add_line{ |
15
|
0
|
|
|
0
|
1
|
|
shift; |
16
|
|
|
|
|
|
|
my @input = ( ref $_[0]->{message} eq 'ARRAY' ) ? |
17
|
0
|
0
|
|
|
|
|
@{$_[0]->{message}} : $_[0]->{message}; |
|
0
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my ( @print_list, @initial_list, $first_line, $last_line, $sprintf_string ); |
19
|
1
|
|
|
1
|
|
4
|
no warnings 'uninitialized'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
192
|
|
20
|
0
|
|
|
|
|
|
for my $value ( @input ){ |
21
|
0
|
0
|
|
|
|
|
push @initial_list, (( ref $value ) ? Dumper( $value ) : $value ); |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
$first_line = shift @initial_list; |
24
|
0
|
|
|
|
|
|
chomp $first_line; |
25
|
0
|
|
|
|
|
|
$first_line =~ s/\r//g; |
26
|
0
|
|
|
|
|
|
$first_line =~ s/\n//g; |
27
|
0
|
0
|
|
|
|
|
if( !@initial_list ){ |
28
|
0
|
|
|
|
|
|
$sprintf_string = "| level - %-6s | name_space - %-s\n| line - %04d | file_name - %-s\n\t:(\t%s ):"; |
29
|
|
|
|
|
|
|
}else{ |
30
|
0
|
|
|
|
|
|
$last_line = pop @initial_list; |
31
|
0
|
|
|
|
|
|
chomp $last_line; |
32
|
0
|
0
|
|
|
|
|
$last_line = length( $last_line ) ? $last_line : "''"; |
33
|
0
|
|
|
|
|
|
$sprintf_string = "| level - %-6s | name_space - %-s\n| line - %04d | file_name - %-s\n\t:( %s"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
diag sprintf( $sprintf_string, |
36
|
|
|
|
|
|
|
$_[0]->{level}, $_[0]->{name_space}, |
37
|
0
|
|
|
|
|
|
$_[0]->{line}, $_[0]->{filename}, $first_line ); |
38
|
0
|
|
|
|
|
|
for my $middle_line ( @initial_list ){ |
39
|
0
|
|
|
|
|
|
diag sprintf( "\t %s", $middle_line ); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
0
|
|
|
|
|
diag sprintf( "\t %s ):", $last_line ) if $last_line; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
1
|
|
4
|
use warnings 'uninitialized'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
98
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#########1 Phinish 3#########4#########5#########6#########7#########8#########9 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#########1 main pod docs 3#########4#########5#########6#########7#########8#########9 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Log::Shiras::Report::Test2Diag - Log::Shiras Test2 diag output |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
use Test2::Bundle::Extended qw( !meta ); |
65
|
|
|
|
|
|
|
use Test2::Plugin::UTF8; |
66
|
|
|
|
|
|
|
plan( ? ); |
67
|
|
|
|
|
|
|
use Log::Shiras::Report::Test2Diag; |
68
|
|
|
|
|
|
|
use Log::Shiras::Switchboard; |
69
|
|
|
|
|
|
|
my( $switchboard, $test_class ); |
70
|
|
|
|
|
|
|
ok( lives{ my $switchboard = Log::Shiras::Switchboard->get_operator( |
71
|
|
|
|
|
|
|
name_space_bounds =>{ |
72
|
|
|
|
|
|
|
UNBLOCK =>{ |
73
|
|
|
|
|
|
|
log_file => 'warn', |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
reports =>{ |
77
|
|
|
|
|
|
|
log_file =>[ Log::Shiras::Report::Test2Diag->new ], #Raise visibility to the actions being tested |
78
|
|
|
|
|
|
|
},) }, "Start the switchboard"); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is a simple L<Report|Log::Shiras::Report> class that can be used to provide |
83
|
|
|
|
|
|
|
troubleshooting output to L<Test2> tests with L<Log::Shiras> content. The goal |
84
|
|
|
|
|
|
|
is for the messages to integrate with the TAP format. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 Attributes |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
None |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 Methods |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head3 new |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=over |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
B<Definition:> This creates a new instance of the Test2Note L<report |
97
|
|
|
|
|
|
|
|Log::Shiras::Switchboard/reports> class. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
B<Returns:> A report class to be stored in the switchboard. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head3 add_line( $ref ) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
B<Definition:> This only accepts a switchboard scrubbed message ref. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
B<Returns:> 1 (or dies) |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SUPPORT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<Log-Shiras/issues|https://github.com/jandrew/Log-Shiras/issues> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 TODO |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
B<1.> Nothing L<currently|/SUPPORT> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 AUTHOR |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item Jed Lund |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item jandrew@cpan.org |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 COPYRIGHT |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This program is free software; you can redistribute |
142
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The full text of the license can be found in the |
145
|
|
|
|
|
|
|
LICENSE file included with this module. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=over |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
L<version> |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L<Data::Dumper> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L<Test2::Tools::Basic> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=back |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
#########1#########2 main pod documentation end 5#########6#########7#########8#########9 |