1TAP::Parser::Result::TeUsste(r3)Contributed Perl DocumenTtAaPt:i:oPnarser::Result::Test(3)
2
3
4

NAME

6       TAP::Parser::Result::Test - Test result token.
7

VERSION

9       Version 3.42
10

DESCRIPTION

12       This is a subclass of TAP::Parser::Result.  A token of this class will
13       be returned if a test line is encountered.
14
15        1..1
16        ok 1 - woo hooo!
17

OVERRIDDEN METHODS

19       This class is the workhorse of the TAP::Parser system.  Most TAP lines
20       will be test lines and if "$result->is_test", then you have a bunch of
21       methods at your disposal.
22
23   Instance Methods
24       "ok"
25
26         my $ok = $result->ok;
27
28       Returns the literal text of the "ok" or "not ok" status.
29
30       "number"
31
32         my $test_number = $result->number;
33
34       Returns the number of the test, even if the original TAP output did not
35       supply that number.
36
37       "description"
38
39         my $description = $result->description;
40
41       Returns the description of the test, if any.  This is the portion after
42       the test number but before the directive.
43
44       "directive"
45
46         my $directive = $result->directive;
47
48       Returns either "TODO" or "SKIP" if either directive was present for a
49       test line.
50
51       "explanation"
52
53         my $explanation = $result->explanation;
54
55       If a test had either a "TODO" or "SKIP" directive, this method will
56       return the accompanying explanation, if present.
57
58         not ok 17 - 'Pigs can fly' # TODO not enough acid
59
60       For the above line, the explanation is not enough acid.
61
62       "is_ok"
63
64         if ( $result->is_ok ) { ... }
65
66       Returns a boolean value indicating whether or not the test passed.
67       Remember that for TODO tests, the test always passes.
68
69       If the test is unplanned, this method will always return false.  See
70       "is_unplanned".
71
72       "is_actual_ok"
73
74         if ( $result->is_actual_ok ) { ... }
75
76       Returns a boolean value indicating whether or not the test passed,
77       regardless of its TODO status.
78
79       "actual_passed"
80
81       Deprecated.  Please use "is_actual_ok" instead.
82
83       "todo_passed"
84
85         if ( $test->todo_passed ) {
86            # test unexpectedly succeeded
87         }
88
89       If this is a TODO test and an 'ok' line, this method returns true.
90       Otherwise, it will always return false (regardless of passing status on
91       non-todo tests).
92
93       This is used to track which tests unexpectedly succeeded.
94
95       "todo_failed"
96
97         # deprecated in favor of 'todo_passed'.  This method was horribly misnamed.
98
99       This was a badly misnamed method.  It indicates which TODO tests
100       unexpectedly succeeded.  Will now issue a warning and call
101       "todo_passed".
102
103       "has_skip"
104
105         if ( $result->has_skip ) { ... }
106
107       Returns a boolean value indicating whether or not this test has a SKIP
108       directive.
109
110       "has_todo"
111
112         if ( $result->has_todo ) { ... }
113
114       Returns a boolean value indicating whether or not this test has a TODO
115       directive.
116
117       "as_string"
118
119         print $result->as_string;
120
121       This method prints the test as a string.  It will probably be similar,
122       but not necessarily identical, to the original test line.  Directives
123       are capitalized, some whitespace may be trimmed and a test number will
124       be added if it was not present in the original line.  If you need the
125       original text of the test line, use the "raw" method.
126
127       "is_unplanned"
128
129         if ( $test->is_unplanned ) { ... }
130         $test->is_unplanned(1);
131
132       If a test number is greater than the number of planned tests, this
133       method will return true.  Unplanned tests will always return false for
134       "is_ok", regardless of whether or not the test "has_todo".
135
136       Note that if tests have a trailing plan, it is not possible to set this
137       property for unplanned tests as we do not know it's unplanned until the
138       plan is reached:
139
140         print <<'END';
141         ok 1
142         ok 2
143         1..1
144         END
145
146
147
148perl v5.26.3                      2018-03-19      TAP::Parser::Result::Test(3)
Impressum