1Test2::Harness::CollectUosre:r:TCaopnPtarrisbeurt(e3d)PTeerslt2D:o:cHuamrennetsast:i:oCnollector::TapParser(3)
2
3
4
6 Test2::Harness::Collector::TapParser - Produce EventFacets from a line
7 of TAP.
8
10 This module is responsible for reading and processing any TAP output
11 from tests. Lines of TAP output are processed into Test2::Event facet
12 data. Note that "Test2 -> TAP -> Test2" is lossy at the "Test2 -> TAP"
13 step.
14
16 use Test2::Harness::Collector::TapParser qw/parse_tap_line/;
17
18 my $facet_data = parse_tap_line("1..1");
19 is(
20 $facet_data,
21 {
22 trace => {nested => 0},
23 hubs => [{nested => 0}],
24 plan => {
25 details => '',
26 count => 1,
27 skip => 0,
28 },
29 },
30 "Parsed the plan"
31 );
32
33 $facet_data = parse_tap_line("# foo");
34 is(
35 $facet_data,
36 {
37 trace => { nested => 0 },
38 hubs => [ { nested => 0 } ],
39 info => [
40 {
41 tag => 'NOTE',
42 details => 'foo',
43 debug => 0,
44 },
45 ],
46 },
47
48 "Parsed the note"
49 );
50
51 $facet_data = parse_tap_line("ok 1");
52 is(
53 $facet_data,
54 {
55 trace => {nested => 0},
56 hubs => [{nested => 0}],
57 assert => {
58 no_debug => 1,
59 pass => 1,
60 number => '1',
61 details => '',
62 },
63 },
64 "Parsed the assertion"
65 );
66
68 $facet_data = parse_tap_line($line)
69 Parse a line of TAP. It is assumed to be STDOUT thus all comments
70 are turned into notes. Using this export will NOT add the usual
71 "from_tap" facet. It is better to use one of the other 2 exports.
72
73 $facet_data = parse_stdout_tap($line)
74 Parse a line of TAP from stdout.
75
76 $facet_data = parse_stderr_tap($line)
77 Parse a line of TAP from stderr. This will ONLY parse comment lines
78 (ones that start with a "#", which may be indented). All comments
79 will be treated as diag's, all other lines will be ignored.
80
82 The source code repository for Test2-Harness can be found at
83 http://github.com/Test-More/Test2-Harness/.
84
86 Chad Granum <exodist@cpan.org>
87
89 Chad Granum <exodist@cpan.org>
90
92 Copyright 2020 Chad Granum <exodist7@gmail.com>.
93
94 This program is free software; you can redistribute it and/or modify it
95 under the same terms as Perl itself.
96
97 See http://dev.perl.org/licenses/
98
99
100
101perl v5.34.1 2022-0T7e-s1t12::Harness::Collector::TapParser(3)