Debian Codegraph @

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