line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Formatter::TextMate::Session; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
248
|
|
4
|
2
|
|
|
2
|
|
1378
|
use TAP::Base; |
|
2
|
|
|
|
|
7604
|
|
|
2
|
|
|
|
|
233
|
|
5
|
2
|
|
|
2
|
|
1382
|
use HTML::Tiny; |
|
2
|
|
|
|
|
4320
|
|
|
2
|
|
|
|
|
52
|
|
6
|
2
|
|
|
2
|
|
2231
|
use URI::file; |
|
2
|
|
|
|
|
59761
|
|
|
2
|
|
|
|
|
122
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.1'; |
9
|
2
|
|
|
2
|
|
27
|
use base 'TAP::Formatter::Console::Session'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
3458
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
TAP::Formatter::TextMate::Session - Harness output delegate for TextMate output |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.1 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$VERSION = '0.1'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This provides output formatting for TAP::Harness. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 C |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Called by the harness for each line of TAP it receives. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _flush_item { |
40
|
11
|
|
|
11
|
|
1476
|
my $self = shift; |
41
|
11
|
|
|
|
|
19
|
my $queue = $self->{queue}; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Get the result... |
44
|
11
|
|
|
|
|
17
|
my $result = shift @$queue; |
45
|
|
|
|
|
|
|
|
46
|
11
|
|
|
|
|
71
|
$self->SUPER::result( $result ); |
47
|
|
|
|
|
|
|
|
48
|
11
|
100
|
100
|
|
|
829
|
if ( $result->is_test && !$result->is_ok ) { |
49
|
3
|
|
|
|
|
121
|
my $html = $self->_html; |
50
|
3
|
|
|
|
|
67
|
my $formatter = $self->formatter; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
22
|
my %def = ( file => $self->name, ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# Look ahead in the queue for YAML. This is messy and is the |
55
|
|
|
|
|
|
|
# whole reason we need to have a queue. |
56
|
3
|
100
|
|
|
|
35
|
if ( my @yaml = grep { $_->is_yaml } @$queue ) { |
|
4
|
|
|
|
|
27
|
|
57
|
2
|
|
|
|
|
31
|
my $data = $yaml[0]->data; |
58
|
2
|
50
|
|
|
|
24
|
%def = ( %def, %$data ) if 'HASH' eq ref $data; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
3
|
50
|
|
|
|
25
|
if ( my $file = delete $def{file} ) { |
62
|
3
|
|
|
|
|
23
|
$def{url} = URI::file->new_abs( $file ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
3
|
|
|
|
|
25964
|
$formatter->_newline; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# See: http://macromates.com/blog/2005/html-output-for-commands/ |
68
|
3
|
|
|
|
|
54
|
my $link = 'txmt://open?' . $html->query_encode( \%def ); |
69
|
3
|
|
|
|
|
643
|
$formatter->_raw_output( |
70
|
|
|
|
|
|
|
$html->span( |
71
|
|
|
|
|
|
|
{ class => 'fail' }, |
72
|
|
|
|
|
|
|
[ $result->raw, ' (', [ \'a', { href => $link }, 'go' ], ')' ] |
73
|
|
|
|
|
|
|
), |
74
|
|
|
|
|
|
|
$html->br, |
75
|
|
|
|
|
|
|
"\n" |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _flush_queue { |
81
|
6
|
|
|
6
|
|
55
|
my $self = shift; |
82
|
6
|
|
|
|
|
11
|
my $queue = $self->{queue}; |
83
|
6
|
|
|
|
|
21
|
$self->_flush_item while @$queue; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub result { |
87
|
11
|
|
|
11
|
1
|
3528
|
my ( $self, $result ) = @_; |
88
|
|
|
|
|
|
|
# When we get the next test process the previous one |
89
|
11
|
100
|
66
|
|
|
100
|
$self->_flush_queue if $result->is_test && $self->{queue}; |
90
|
11
|
|
100
|
|
|
200
|
push @{ $self->{queue} ||= [] }, $result; |
|
11
|
|
|
|
|
91
|
|
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 C |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Called to close a test session. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub close_test { |
100
|
1
|
|
|
1
|
1
|
585
|
my $self = shift; |
101
|
1
|
|
|
|
|
8
|
$self->_flush_queue; |
102
|
1
|
|
|
|
|
177
|
$self->SUPER::close_test; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub _html { |
106
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
107
|
3
|
|
66
|
|
|
20
|
return $self->{_html} ||= HTML::Tiny->new; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
1
|
|
|
1
|
|
85
|
sub _should_show_count { 0 } |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |