TAPx::Parser::Results::Test - Test result token.
Version 0.41
This is a subclass of TAPx::Parser::Results. A token of this class will be returned if a test line is encountered.
TAPx::Parser::Results
1..1 ok 1 - woo hooo!
This class is the workhorse of the TAPx::Parser system. Most TAP lines will be test lines and if $result->is_test, then you have a bunch of methods at your disposal.
$result->is_test
ok
my $ok = $result->ok;
Returns the literal text of the ok or not ok status.
not ok
number
my $test_number = $result->number;
Returns the number of the test, even if the original TAP output did not supply that number.
description
my $description = $result->description;
Returns the description of the test, if any. This is the portion after the test number but before the directive.
my $directive = $result->directive;
Returns either TODO or SKIP if either directive was present for a test line.
TODO
SKIP
my $explanation = $result->explanation;
If a test had either a TODO or SKIP directive, this method will return the accompanying explantion, if present.
not ok 17 - 'Pigs can fly' # TODO not enough acid
For the above line, the explanation is not enough acid.
if ( $result->is_ok ) { ... }
Returns a boolean value indicating whether or not the test passed. Remember that for TODO tests, the test always passes.
is_actual_ok
if ( $result->is_actual_ok ) { ... }
Returns a boolean value indicating whether or not the test passed, regardless of its TODO status.
todo_failed
if ( $test->todo_failed ) { # test unexpectedly succeeded }
If this is a TODO test and an 'ok' line, this method returns true. Otherwise, it will always return false (regardless of passing status on non-todo tests).
This is used to track which tests unexpectedly succeeded.
has_skip
if ( $result->has_skip ) { ... }
Returns a boolean value indicating whether or not this test has a SKIP directive.
has_todo
if ( $result->has_todo ) { ... }
Returns a boolean value indicating whether or not this test has a TODO directive.
print $result->as_string;
This method prints the test as a string. It will probably be similar, but not necessarily identical, to the original test line. Directives are capitalized, some whitespace may be trimmed and a test number will be added if it was not present in the original line. If you need the original text of the test line, use the raw method.
raw
To install TAPx::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TAPx::Parser
CPAN shell
perl -MCPAN -e shell install TAPx::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.