line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Harness::Parser; |
2
|
28
|
|
|
28
|
|
127410
|
use strict; |
|
28
|
|
|
|
|
9
|
|
|
28
|
|
|
|
|
677
|
|
3
|
28
|
|
|
28
|
|
66
|
use warnings; |
|
28
|
|
|
|
|
29
|
|
|
28
|
|
|
|
|
931
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000013'; |
6
|
|
|
|
|
|
|
|
7
|
28
|
|
|
28
|
|
84
|
use Carp qw/croak/; |
|
28
|
|
|
|
|
7
|
|
|
28
|
|
|
|
|
1008
|
|
8
|
28
|
|
|
28
|
|
86
|
use Scalar::Util qw/blessed/; |
|
28
|
|
|
|
|
28
|
|
|
28
|
|
|
|
|
862
|
|
9
|
|
|
|
|
|
|
|
10
|
28
|
|
|
28
|
|
69
|
use Test2::Util qw/pkg_to_file/; |
|
28
|
|
|
|
|
28
|
|
|
28
|
|
|
|
|
1046
|
|
11
|
|
|
|
|
|
|
|
12
|
28
|
|
|
28
|
|
8399
|
use Test2::Event::ParserSelect; |
|
28
|
|
|
|
|
29
|
|
|
28
|
|
|
|
|
546
|
|
13
|
|
|
|
|
|
|
|
14
|
28
|
|
|
28
|
|
111
|
use Test2::Util::HashBase qw/proc job/; |
|
28
|
|
|
|
|
27
|
|
|
28
|
|
|
|
|
62
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
611
|
1
|
|
sub morph {} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init { |
19
|
623
|
|
|
623
|
0
|
234346
|
my $self = shift; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
croak "'proc' is a required attribute" |
22
|
623
|
100
|
|
|
|
2142
|
unless $self->{+PROC}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
croak "'job' is a required attribute" |
25
|
621
|
100
|
|
|
|
1500
|
unless $self->{+JOB}; |
26
|
|
|
|
|
|
|
|
27
|
619
|
|
|
|
|
1756
|
$self->morph; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub step { |
31
|
11885
|
|
|
11885
|
1
|
8627
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
11885
|
|
|
|
|
26487
|
my $class = blessed($self); |
34
|
11885
|
|
|
|
|
22032
|
my $line = $self->proc->get_out_line(peek => 1); |
35
|
11885
|
100
|
|
|
|
17713
|
chomp $line if defined $line; |
36
|
11885
|
100
|
66
|
|
|
31966
|
return unless defined $line && length $line; |
37
|
|
|
|
|
|
|
|
38
|
611
|
50
|
33
|
|
|
3946
|
if ($class eq __PACKAGE__ && $line) { |
39
|
611
|
100
|
|
|
|
5950
|
if ($line =~ m/^T2_FORMATTER: (.+)$/) { |
40
|
346
|
|
|
|
|
2477
|
chomp(my $fmt = $1); |
41
|
346
|
|
|
|
|
1341
|
$fmt =~ s/[\r\s]+$//g; |
42
|
346
|
|
|
|
|
1447
|
my $class = "Test2::Harness::Parser::$fmt"; |
43
|
346
|
|
|
|
|
3043
|
require(pkg_to_file($class)); |
44
|
346
|
|
|
|
|
14453
|
bless($self, $class); |
45
|
346
|
|
|
|
|
2709
|
$self->morph; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Strip off the line, it has been processed |
48
|
346
|
|
|
|
|
1219
|
$self->proc->get_out_line; |
49
|
|
|
|
|
|
|
|
50
|
346
|
|
|
|
|
3656
|
return Test2::Event::ParserSelect->new( |
51
|
|
|
|
|
|
|
parser_class => $class, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
265
|
100
|
|
|
|
4306
|
if ($line =~ m/^\s*(ok\b|not ok\b|1\.\.\d+|Bail out!|TAP version|^\#.+)/) { |
56
|
263
|
|
|
|
|
18767
|
require Test2::Harness::Parser::TAP; |
57
|
263
|
|
|
|
|
3248
|
bless($self, 'Test2::Harness::Parser::TAP'); |
58
|
263
|
|
|
|
|
4116
|
$self->morph; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Do not strip off the line, we need the TAP parser to eat it. |
61
|
263
|
|
|
|
|
3513
|
return Test2::Event::ParserSelect->new( |
62
|
|
|
|
|
|
|
parser_class => 'Test2::Harness::Parser::TAP', |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
2
|
50
|
|
|
|
8
|
if ($class eq __PACKAGE__) { |
68
|
2
|
|
|
|
|
12
|
die 'You cannot use Test2::Harness::Parser itself, it must be subclassed'; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
0
|
|
|
|
|
|
die "The $class class must implement the step method"; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |