| 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::Test 3perl" |
| 58 |
.TH TAP::Parser::Result::Test 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::Test \- Test result token. |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
Version 3.48 |
| 68 |
.SH DESCRIPTION |
| 69 |
.IX Header "DESCRIPTION" |
| 70 |
This is a subclass of TAP::Parser::Result. A token of this class will be |
| 71 |
returned if a test line is encountered. |
| 72 |
.PP |
| 73 |
.Vb 2 |
| 74 |
\& 1..1 |
| 75 |
\& ok 1 \- woo hooo! |
| 76 |
.Ve |
| 77 |
.SH "OVERRIDDEN METHODS" |
| 78 |
.IX Header "OVERRIDDEN METHODS" |
| 79 |
This class is the workhorse of the TAP::Parser system. Most TAP lines will |
| 80 |
be test lines and if \f(CW\*(C`$result\->is_test\*(C'\fR, then you have a bunch of methods |
| 81 |
at your disposal. |
| 82 |
.SS "Instance Methods" |
| 83 |
.IX Subsection "Instance Methods" |
| 84 |
\fR\f(CI\*(C`ok\*(C'\fR\fI\fR |
| 85 |
.IX Subsection "ok" |
| 86 |
.PP |
| 87 |
.Vb 1 |
| 88 |
\& my $ok = $result\->ok; |
| 89 |
.Ve |
| 90 |
.PP |
| 91 |
Returns the literal text of the \f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`not ok\*(C'\fR status. |
| 92 |
.PP |
| 93 |
\fR\f(CI\*(C`number\*(C'\fR\fI\fR |
| 94 |
.IX Subsection "number" |
| 95 |
.PP |
| 96 |
.Vb 1 |
| 97 |
\& my $test_number = $result\->number; |
| 98 |
.Ve |
| 99 |
.PP |
| 100 |
Returns the number of the test, even if the original TAP output did not supply |
| 101 |
that number. |
| 102 |
.PP |
| 103 |
\fR\f(CI\*(C`description\*(C'\fR\fI\fR |
| 104 |
.IX Subsection "description" |
| 105 |
.PP |
| 106 |
.Vb 1 |
| 107 |
\& my $description = $result\->description; |
| 108 |
.Ve |
| 109 |
.PP |
| 110 |
Returns the description of the test, if any. This is the portion after the |
| 111 |
test number but before the directive. |
| 112 |
.PP |
| 113 |
\fR\f(CI\*(C`directive\*(C'\fR\fI\fR |
| 114 |
.IX Subsection "directive" |
| 115 |
.PP |
| 116 |
.Vb 1 |
| 117 |
\& my $directive = $result\->directive; |
| 118 |
.Ve |
| 119 |
.PP |
| 120 |
Returns either \f(CW\*(C`TODO\*(C'\fR or \f(CW\*(C`SKIP\*(C'\fR if either directive was present for a test |
| 121 |
line. |
| 122 |
.PP |
| 123 |
\fR\f(CI\*(C`explanation\*(C'\fR\fI\fR |
| 124 |
.IX Subsection "explanation" |
| 125 |
.PP |
| 126 |
.Vb 1 |
| 127 |
\& my $explanation = $result\->explanation; |
| 128 |
.Ve |
| 129 |
.PP |
| 130 |
If a test had either a \f(CW\*(C`TODO\*(C'\fR or \f(CW\*(C`SKIP\*(C'\fR directive, this method will return |
| 131 |
the accompanying explanation, if present. |
| 132 |
.PP |
| 133 |
.Vb 1 |
| 134 |
\& not ok 17 \- \*(AqPigs can fly\*(Aq # TODO not enough acid |
| 135 |
.Ve |
| 136 |
.PP |
| 137 |
For the above line, the explanation is \fInot enough acid\fR. |
| 138 |
.PP |
| 139 |
\fR\f(CI\*(C`is_ok\*(C'\fR\fI\fR |
| 140 |
.IX Subsection "is_ok" |
| 141 |
.PP |
| 142 |
.Vb 1 |
| 143 |
\& if ( $result\->is_ok ) { ... } |
| 144 |
.Ve |
| 145 |
.PP |
| 146 |
Returns a boolean value indicating whether or not the test passed. Remember |
| 147 |
that for TODO tests, the test always passes. |
| 148 |
.PP |
| 149 |
If the test is unplanned, this method will always return false. See |
| 150 |
\&\f(CW\*(C`is_unplanned\*(C'\fR. |
| 151 |
.PP |
| 152 |
\fR\f(CI\*(C`is_actual_ok\*(C'\fR\fI\fR |
| 153 |
.IX Subsection "is_actual_ok" |
| 154 |
.PP |
| 155 |
.Vb 1 |
| 156 |
\& if ( $result\->is_actual_ok ) { ... } |
| 157 |
.Ve |
| 158 |
.PP |
| 159 |
Returns a boolean value indicating whether or not the test passed, regardless |
| 160 |
of its TODO status. |
| 161 |
.PP |
| 162 |
\fR\f(CI\*(C`actual_passed\*(C'\fR\fI\fR |
| 163 |
.IX Subsection "actual_passed" |
| 164 |
.PP |
| 165 |
Deprecated. Please use \f(CW\*(C`is_actual_ok\*(C'\fR instead. |
| 166 |
.PP |
| 167 |
\fR\f(CI\*(C`todo_passed\*(C'\fR\fI\fR |
| 168 |
.IX Subsection "todo_passed" |
| 169 |
.PP |
| 170 |
.Vb 3 |
| 171 |
\& if ( $test\->todo_passed ) { |
| 172 |
\& # test unexpectedly succeeded |
| 173 |
\& } |
| 174 |
.Ve |
| 175 |
.PP |
| 176 |
If this is a TODO test and an 'ok' line, this method returns true. |
| 177 |
Otherwise, it will always return false (regardless of passing status on |
| 178 |
non-todo tests). |
| 179 |
.PP |
| 180 |
This is used to track which tests unexpectedly succeeded. |
| 181 |
.PP |
| 182 |
\fR\f(CI\*(C`todo_failed\*(C'\fR\fI\fR |
| 183 |
.IX Subsection "todo_failed" |
| 184 |
.PP |
| 185 |
.Vb 1 |
| 186 |
\& # deprecated in favor of \*(Aqtodo_passed\*(Aq. This method was horribly misnamed. |
| 187 |
.Ve |
| 188 |
.PP |
| 189 |
This was a badly misnamed method. It indicates which TODO tests unexpectedly |
| 190 |
succeeded. Will now issue a warning and call \f(CW\*(C`todo_passed\*(C'\fR. |
| 191 |
.PP |
| 192 |
\fR\f(CI\*(C`has_skip\*(C'\fR\fI\fR |
| 193 |
.IX Subsection "has_skip" |
| 194 |
.PP |
| 195 |
.Vb 1 |
| 196 |
\& if ( $result\->has_skip ) { ... } |
| 197 |
.Ve |
| 198 |
.PP |
| 199 |
Returns a boolean value indicating whether or not this test has a SKIP |
| 200 |
directive. |
| 201 |
.PP |
| 202 |
\fR\f(CI\*(C`has_todo\*(C'\fR\fI\fR |
| 203 |
.IX Subsection "has_todo" |
| 204 |
.PP |
| 205 |
.Vb 1 |
| 206 |
\& if ( $result\->has_todo ) { ... } |
| 207 |
.Ve |
| 208 |
.PP |
| 209 |
Returns a boolean value indicating whether or not this test has a TODO |
| 210 |
directive. |
| 211 |
.PP |
| 212 |
\fR\f(CI\*(C`as_string\*(C'\fR\fI\fR |
| 213 |
.IX Subsection "as_string" |
| 214 |
.PP |
| 215 |
.Vb 1 |
| 216 |
\& print $result\->as_string; |
| 217 |
.Ve |
| 218 |
.PP |
| 219 |
This method prints the test as a string. It will probably be similar, but |
| 220 |
not necessarily identical, to the original test line. Directives are |
| 221 |
capitalized, some whitespace may be trimmed and a test number will be added if |
| 222 |
it was not present in the original line. If you need the original text of the |
| 223 |
test line, use the \f(CW\*(C`raw\*(C'\fR method. |
| 224 |
.PP |
| 225 |
\fR\f(CI\*(C`is_unplanned\*(C'\fR\fI\fR |
| 226 |
.IX Subsection "is_unplanned" |
| 227 |
.PP |
| 228 |
.Vb 2 |
| 229 |
\& if ( $test\->is_unplanned ) { ... } |
| 230 |
\& $test\->is_unplanned(1); |
| 231 |
.Ve |
| 232 |
.PP |
| 233 |
If a test number is greater than the number of planned tests, this method will |
| 234 |
return true. Unplanned tests will \fIalways\fR return false for \f(CW\*(C`is_ok\*(C'\fR, |
| 235 |
regardless of whether or not the test \f(CW\*(C`has_todo\*(C'\fR. |
| 236 |
.PP |
| 237 |
Note that if tests have a trailing plan, it is not possible to set this |
| 238 |
property for unplanned tests as we do not know it's unplanned until the plan |
| 239 |
is reached: |
| 240 |
.PP |
| 241 |
.Vb 5 |
| 242 |
\& print <<\*(AqEND\*(Aq; |
| 243 |
\& ok 1 |
| 244 |
\& ok 2 |
| 245 |
\& 1..1 |
| 246 |
\& END |
| 247 |
.Ve |