Debian Codegraph @

upstream/mageia-cauldron/man3pm/TAP::Parser::Result.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "TAP::Parser::Result 3pm"
61 .TH TAP::Parser::Result 3pm 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 TAP::Parser::Result \- Base class for TAP::Parser output objects
68 .SH VERSION
69 .IX Header "VERSION"
70 Version 3.50
71 .SH SYNOPSIS
72 .IX Header "SYNOPSIS"
73 .Vb 2
74 \& # abstract class \- not meant to be used directly
75 \& # see TAP::Parser::ResultFactory for preferred usage
76 \&
77 \& # directly:
78 \& use TAP::Parser::Result;
79 \& my $token = {...};
80 \& my $result = TAP::Parser::Result\->new( $token );
81 .Ve
82 .SS DESCRIPTION
83 .IX Subsection "DESCRIPTION"
84 This is a simple base class used by TAP::Parser to store objects that
85 represent the current bit of test output data from TAP (usually a single
86 line). Unless you\*(Aqre subclassing, you probably won\*(Aqt need to use this module
87 directly.
88 .SS METHODS
89 .IX Subsection "METHODS"
90 \fR\f(CI\*(C`new\*(C'\fR\fI\fR
91 .IX Subsection "new"
92 .PP
93 .Vb 1
94 \& # see TAP::Parser::ResultFactory for preferred usage
95 \&
96 \& # to use directly:
97 \& my $result = TAP::Parser::Result\->new($token);
98 .Ve
99 .PP
100 Returns an instance the appropriate class for the test token passed in.
101 .SS "Boolean methods"
102 .IX Subsection "Boolean methods"
103 The following methods all return a boolean value and are to be overridden in
104 the appropriate subclass.
105 .IP \(bu 4
106 \&\f(CW\*(C`is_plan\*(C'\fR
107 .Sp
108 Indicates whether or not this is the test plan line.
109 .Sp
110 .Vb 1
111 \& 1..3
112 .Ve
113 .IP \(bu 4
114 \&\f(CW\*(C`is_pragma\*(C'\fR
115 .Sp
116 Indicates whether or not this is a pragma line.
117 .Sp
118 .Vb 1
119 \& pragma +strict
120 .Ve
121 .IP \(bu 4
122 \&\f(CW\*(C`is_test\*(C'\fR
123 .Sp
124 Indicates whether or not this is a test line.
125 .Sp
126 .Vb 1
127 \& ok 1 Is OK!
128 .Ve
129 .IP \(bu 4
130 \&\f(CW\*(C`is_comment\*(C'\fR
131 .Sp
132 Indicates whether or not this is a comment.
133 .Sp
134 .Vb 1
135 \& # this is a comment
136 .Ve
137 .IP \(bu 4
138 \&\f(CW\*(C`is_bailout\*(C'\fR
139 .Sp
140 Indicates whether or not this is bailout line.
141 .Sp
142 .Vb 1
143 \& Bail out! We\*(Aqre out of dilithium crystals.
144 .Ve
145 .IP \(bu 4
146 \&\f(CW\*(C`is_version\*(C'\fR
147 .Sp
148 Indicates whether or not this is a TAP version line.
149 .Sp
150 .Vb 1
151 \& TAP version 4
152 .Ve
153 .IP \(bu 4
154 \&\f(CW\*(C`is_unknown\*(C'\fR
155 .Sp
156 Indicates whether or not the current line could be parsed.
157 .Sp
158 .Vb 1
159 \& ... this line is junk ...
160 .Ve
161 .IP \(bu 4
162 \&\f(CW\*(C`is_yaml\*(C'\fR
163 .Sp
164 Indicates whether or not this is a YAML chunk.
165 .PP
166 \fR\f(CI\*(C`raw\*(C'\fR\fI\fR
167 .IX Subsection "raw"
168 .PP
169 .Vb 1
170 \& print $result\->raw;
171 .Ve
172 .PP
173 Returns the original line of text which was parsed.
174 .PP
175 \fR\f(CI\*(C`type\*(C'\fR\fI\fR
176 .IX Subsection "type"
177 .PP
178 .Vb 1
179 \& my $type = $result\->type;
180 .Ve
181 .PP
182 Returns the "type" of a token, such as \f(CW\*(C`comment\*(C'\fR or \f(CW\*(C`test\*(C'\fR.
183 .PP
184 \fR\f(CI\*(C`as_string\*(C'\fR\fI\fR
185 .IX Subsection "as_string"
186 .PP
187 .Vb 1
188 \& print $result\->as_string;
189 .Ve
190 .PP
191 Prints a string representation of the token. This might not be the exact
192 output, however. Tests will have test numbers added if not present, TODO and
193 SKIP directives will be capitalized and, in general, things will be cleaned
194 up. If you need the original text for the token, see the \f(CW\*(C`raw\*(C'\fR method.
195 .PP
196 \fR\f(CI\*(C`is_ok\*(C'\fR\fI\fR
197 .IX Subsection "is_ok"
198 .PP
199 .Vb 1
200 \& if ( $result\->is_ok ) { ... }
201 .Ve
202 .PP
203 Reports whether or not a given result has passed. Anything which is \fBnot\fR a
204 test result returns true. This is merely provided as a convenient shortcut.
205 .PP
206 \fR\f(CI\*(C`passed\*(C'\fR\fI\fR
207 .IX Subsection "passed"
208 .PP
209 Deprecated. Please use \f(CW\*(C`is_ok\*(C'\fR instead.
210 .PP
211 \fR\f(CI\*(C`has_directive\*(C'\fR\fI\fR
212 .IX Subsection "has_directive"
213 .PP
214 .Vb 3
215 \& if ( $result\->has_directive ) {
216 \& ...
217 \& }
218 .Ve
219 .PP
220 Indicates whether or not the given result has a TODO or SKIP directive.
221 .PP
222 \fR\f(CI\*(C`has_todo\*(C'\fR\fI\fR
223 .IX Subsection "has_todo"
224 .PP
225 .Vb 3
226 \& if ( $result\->has_todo ) {
227 \& ...
228 \& }
229 .Ve
230 .PP
231 Indicates whether or not the given result has a TODO directive.
232 .PP
233 \fR\f(CI\*(C`has_skip\*(C'\fR\fI\fR
234 .IX Subsection "has_skip"
235 .PP
236 .Vb 3
237 \& if ( $result\->has_skip ) {
238 \& ...
239 \& }
240 .Ve
241 .PP
242 Indicates whether or not the given result has a SKIP directive.
243 .PP
244 \fR\f(CI\*(C`set_directive\*(C'\fR\fI\fR
245 .IX Subsection "set_directive"
246 .PP
247 Set the directive associated with this token. Used internally to fake
248 TODO tests.
249 .SH SUBCLASSING
250 .IX Header "SUBCLASSING"
251 Please see "SUBCLASSING" in TAP::Parser for a subclassing overview.
252 .PP
253 Remember: if you want your subclass to be automatically used by the parser,
254 you\*(Aqll have to register it with "register_type" in TAP::Parser::ResultFactory.
255 .PP
256 If you\*(Aqre creating a completely new result \fItype\fR, you\*(Aqll probably need to
257 subclass TAP::Parser::Grammar too, or else it\*(Aqll never get used.
258 .SS Example
259 .IX Subsection "Example"
260 .Vb 1
261 \& package MyResult;
262 \&
263 \& use strict;
264 \&
265 \& use base \*(AqTAP::Parser::Result\*(Aq;
266 \&
267 \& # register with the factory:
268 \& TAP::Parser::ResultFactory\->register_type( \*(Aqmy_type\*(Aq => _\|_PACKAGE_\|_ );
269 \&
270 \& sub as_string { \*(AqMy results all look the same\*(Aq }
271 .Ve
272 .SH "SEE ALSO"
273 .IX Header "SEE ALSO"
274 TAP::Object,
275 TAP::Parser,
276 TAP::Parser::ResultFactory,
277 TAP::Parser::Result::Bailout,
278 TAP::Parser::Result::Comment,
279 TAP::Parser::Result::Plan,
280 TAP::Parser::Result::Pragma,
281 TAP::Parser::Result::Test,
282 TAP::Parser::Result::Unknown,
283 TAP::Parser::Result::Version,
284 TAP::Parser::Result::YAML,