NAME
TB2::Result::Base - Store the result of an assert
SYNOPSIS
# Use TB2::Result as a factory, not TB2::Result::Base directly
my $result = TB2::Result->new_result(%options);
DESCRIPTION
This represents the result of an assert, whether it passed or failed, if it had any modifiers (directives), additional diagnostic information, etc...
NOTE: This object is in a very high state of flux.
Overloading
A Result object used as a boolean will be true if the assert passed, false otherwise.
METHODS
It has all the attributes and methods of a normal TB2::Event plus...
Attributes
name
my $name = $result->name;
The name of the assert. For example...
# The name is "addition"
ok( 1 + 1, "addition" );
diag
my $diag = $result->diag;
The structured diagnostics associated with this result.
Diagnostics are currently an array ref of key/value pairs. Its an array ref to keep the order. This will probably change.
reason
my $reason = $result->reason;
The reason for any modifiers.
test_number
my $number = $result->test_number;
The number associated with this test, if any.
NOTE that most testing systems don't number their results. And even TAP tests are not required to do so.
Methods
build_event_type
my $type = $result->build_event_type;
Returns the type of this Event, for differenciation between other Event objects.
The type is "result".
literal_pass
Returns true if the assert passed without regard to any modifiers.
is_unknown
Returns true if the result is unknown. This usually indicates that there should be a test here but none was written or it was skipped.
An example is a test skipped because it is not relevant to the current environment (like a Windows specific test on a Unix machine).
is_pass
Returns true if this test is considered a pass after consideration of any modifiers.
For example, the result of a TODO test is always considered a pass no matter what the actual result of the assert is.
is_fail
The opposite of is_pass.
is_todo
Returns true if this result is TODO.
is_skip
Returns true if the assert was recording as existing but never run.
SEE ALSO
TB2::Result Factory for creating results
TB2::History Store the results
TB2::Formatter Format results for display