| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (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 |
.\" |
| 57 |
.IX Title "TAP::Parser::Result 3perl" |
| 58 |
.TH TAP::Parser::Result 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
TAP::Parser::Result \- Base class for TAP::Parser output objects |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
Version 3.48 |
| 68 |
.SH SYNOPSIS |
| 69 |
.IX Header "SYNOPSIS" |
| 70 |
.Vb 2 |
| 71 |
\& # abstract class \- not meant to be used directly |
| 72 |
\& # see TAP::Parser::ResultFactory for preferred usage |
| 73 |
\& |
| 74 |
\& # directly: |
| 75 |
\& use TAP::Parser::Result; |
| 76 |
\& my $token = {...}; |
| 77 |
\& my $result = TAP::Parser::Result\->new( $token ); |
| 78 |
.Ve |
| 79 |
.SS DESCRIPTION |
| 80 |
.IX Subsection "DESCRIPTION" |
| 81 |
This is a simple base class used by TAP::Parser to store objects that |
| 82 |
represent the current bit of test output data from TAP (usually a single |
| 83 |
line). Unless you're subclassing, you probably won't need to use this module |
| 84 |
directly. |
| 85 |
.SS METHODS |
| 86 |
.IX Subsection "METHODS" |
| 87 |
\fR\f(CI\*(C`new\*(C'\fR\fI\fR |
| 88 |
.IX Subsection "new" |
| 89 |
.PP |
| 90 |
.Vb 1 |
| 91 |
\& # see TAP::Parser::ResultFactory for preferred usage |
| 92 |
\& |
| 93 |
\& # to use directly: |
| 94 |
\& my $result = TAP::Parser::Result\->new($token); |
| 95 |
.Ve |
| 96 |
.PP |
| 97 |
Returns an instance the appropriate class for the test token passed in. |
| 98 |
.SS "Boolean methods" |
| 99 |
.IX Subsection "Boolean methods" |
| 100 |
The following methods all return a boolean value and are to be overridden in |
| 101 |
the appropriate subclass. |
| 102 |
.IP \(bu 4 |
| 103 |
\&\f(CW\*(C`is_plan\*(C'\fR |
| 104 |
.Sp |
| 105 |
Indicates whether or not this is the test plan line. |
| 106 |
.Sp |
| 107 |
.Vb 1 |
| 108 |
\& 1..3 |
| 109 |
.Ve |
| 110 |
.IP \(bu 4 |
| 111 |
\&\f(CW\*(C`is_pragma\*(C'\fR |
| 112 |
.Sp |
| 113 |
Indicates whether or not this is a pragma line. |
| 114 |
.Sp |
| 115 |
.Vb 1 |
| 116 |
\& pragma +strict |
| 117 |
.Ve |
| 118 |
.IP \(bu 4 |
| 119 |
\&\f(CW\*(C`is_test\*(C'\fR |
| 120 |
.Sp |
| 121 |
Indicates whether or not this is a test line. |
| 122 |
.Sp |
| 123 |
.Vb 1 |
| 124 |
\& ok 1 Is OK! |
| 125 |
.Ve |
| 126 |
.IP \(bu 4 |
| 127 |
\&\f(CW\*(C`is_comment\*(C'\fR |
| 128 |
.Sp |
| 129 |
Indicates whether or not this is a comment. |
| 130 |
.Sp |
| 131 |
.Vb 1 |
| 132 |
\& # this is a comment |
| 133 |
.Ve |
| 134 |
.IP \(bu 4 |
| 135 |
\&\f(CW\*(C`is_bailout\*(C'\fR |
| 136 |
.Sp |
| 137 |
Indicates whether or not this is bailout line. |
| 138 |
.Sp |
| 139 |
.Vb 1 |
| 140 |
\& Bail out! We\*(Aqre out of dilithium crystals. |
| 141 |
.Ve |
| 142 |
.IP \(bu 4 |
| 143 |
\&\f(CW\*(C`is_version\*(C'\fR |
| 144 |
.Sp |
| 145 |
Indicates whether or not this is a TAP version line. |
| 146 |
.Sp |
| 147 |
.Vb 1 |
| 148 |
\& TAP version 4 |
| 149 |
.Ve |
| 150 |
.IP \(bu 4 |
| 151 |
\&\f(CW\*(C`is_unknown\*(C'\fR |
| 152 |
.Sp |
| 153 |
Indicates whether or not the current line could be parsed. |
| 154 |
.Sp |
| 155 |
.Vb 1 |
| 156 |
\& ... this line is junk ... |
| 157 |
.Ve |
| 158 |
.IP \(bu 4 |
| 159 |
\&\f(CW\*(C`is_yaml\*(C'\fR |
| 160 |
.Sp |
| 161 |
Indicates whether or not this is a YAML chunk. |
| 162 |
.PP |
| 163 |
\fR\f(CI\*(C`raw\*(C'\fR\fI\fR |
| 164 |
.IX Subsection "raw" |
| 165 |
.PP |
| 166 |
.Vb 1 |
| 167 |
\& print $result\->raw; |
| 168 |
.Ve |
| 169 |
.PP |
| 170 |
Returns the original line of text which was parsed. |
| 171 |
.PP |
| 172 |
\fR\f(CI\*(C`type\*(C'\fR\fI\fR |
| 173 |
.IX Subsection "type" |
| 174 |
.PP |
| 175 |
.Vb 1 |
| 176 |
\& my $type = $result\->type; |
| 177 |
.Ve |
| 178 |
.PP |
| 179 |
Returns the "type" of a token, such as \f(CW\*(C`comment\*(C'\fR or \f(CW\*(C`test\*(C'\fR. |
| 180 |
.PP |
| 181 |
\fR\f(CI\*(C`as_string\*(C'\fR\fI\fR |
| 182 |
.IX Subsection "as_string" |
| 183 |
.PP |
| 184 |
.Vb 1 |
| 185 |
\& print $result\->as_string; |
| 186 |
.Ve |
| 187 |
.PP |
| 188 |
Prints a string representation of the token. This might not be the exact |
| 189 |
output, however. Tests will have test numbers added if not present, TODO and |
| 190 |
SKIP directives will be capitalized and, in general, things will be cleaned |
| 191 |
up. If you need the original text for the token, see the \f(CW\*(C`raw\*(C'\fR method. |
| 192 |
.PP |
| 193 |
\fR\f(CI\*(C`is_ok\*(C'\fR\fI\fR |
| 194 |
.IX Subsection "is_ok" |
| 195 |
.PP |
| 196 |
.Vb 1 |
| 197 |
\& if ( $result\->is_ok ) { ... } |
| 198 |
.Ve |
| 199 |
.PP |
| 200 |
Reports whether or not a given result has passed. Anything which is \fBnot\fR a |
| 201 |
test result returns true. This is merely provided as a convenient shortcut. |
| 202 |
.PP |
| 203 |
\fR\f(CI\*(C`passed\*(C'\fR\fI\fR |
| 204 |
.IX Subsection "passed" |
| 205 |
.PP |
| 206 |
Deprecated. Please use \f(CW\*(C`is_ok\*(C'\fR instead. |
| 207 |
.PP |
| 208 |
\fR\f(CI\*(C`has_directive\*(C'\fR\fI\fR |
| 209 |
.IX Subsection "has_directive" |
| 210 |
.PP |
| 211 |
.Vb 3 |
| 212 |
\& if ( $result\->has_directive ) { |
| 213 |
\& ... |
| 214 |
\& } |
| 215 |
.Ve |
| 216 |
.PP |
| 217 |
Indicates whether or not the given result has a TODO or SKIP directive. |
| 218 |
.PP |
| 219 |
\fR\f(CI\*(C`has_todo\*(C'\fR\fI\fR |
| 220 |
.IX Subsection "has_todo" |
| 221 |
.PP |
| 222 |
.Vb 3 |
| 223 |
\& if ( $result\->has_todo ) { |
| 224 |
\& ... |
| 225 |
\& } |
| 226 |
.Ve |
| 227 |
.PP |
| 228 |
Indicates whether or not the given result has a TODO directive. |
| 229 |
.PP |
| 230 |
\fR\f(CI\*(C`has_skip\*(C'\fR\fI\fR |
| 231 |
.IX Subsection "has_skip" |
| 232 |
.PP |
| 233 |
.Vb 3 |
| 234 |
\& if ( $result\->has_skip ) { |
| 235 |
\& ... |
| 236 |
\& } |
| 237 |
.Ve |
| 238 |
.PP |
| 239 |
Indicates whether or not the given result has a SKIP directive. |
| 240 |
.PP |
| 241 |
\fR\f(CI\*(C`set_directive\*(C'\fR\fI\fR |
| 242 |
.IX Subsection "set_directive" |
| 243 |
.PP |
| 244 |
Set the directive associated with this token. Used internally to fake |
| 245 |
TODO tests. |
| 246 |
.SH SUBCLASSING |
| 247 |
.IX Header "SUBCLASSING" |
| 248 |
Please see "SUBCLASSING" in TAP::Parser for a subclassing overview. |
| 249 |
.PP |
| 250 |
Remember: if you want your subclass to be automatically used by the parser, |
| 251 |
you'll have to register it with "register_type" in TAP::Parser::ResultFactory. |
| 252 |
.PP |
| 253 |
If you're creating a completely new result \fItype\fR, you'll probably need to |
| 254 |
subclass TAP::Parser::Grammar too, or else it'll never get used. |
| 255 |
.SS Example |
| 256 |
.IX Subsection "Example" |
| 257 |
.Vb 1 |
| 258 |
\& package MyResult; |
| 259 |
\& |
| 260 |
\& use strict; |
| 261 |
\& |
| 262 |
\& use base \*(AqTAP::Parser::Result\*(Aq; |
| 263 |
\& |
| 264 |
\& # register with the factory: |
| 265 |
\& TAP::Parser::ResultFactory\->register_type( \*(Aqmy_type\*(Aq => _\|_PACKAGE_\|_ ); |
| 266 |
\& |
| 267 |
\& sub as_string { \*(AqMy results all look the same\*(Aq } |
| 268 |
.Ve |
| 269 |
.SH "SEE ALSO" |
| 270 |
.IX Header "SEE ALSO" |
| 271 |
TAP::Object, |
| 272 |
TAP::Parser, |
| 273 |
TAP::Parser::ResultFactory, |
| 274 |
TAP::Parser::Result::Bailout, |
| 275 |
TAP::Parser::Result::Comment, |
| 276 |
TAP::Parser::Result::Plan, |
| 277 |
TAP::Parser::Result::Pragma, |
| 278 |
TAP::Parser::Result::Test, |
| 279 |
TAP::Parser::Result::Unknown, |
| 280 |
TAP::Parser::Result::Version, |
| 281 |
TAP::Parser::Result::YAML, |