Test::Builder2::Result::Base - Store the result of an assert
# Use TB2::Result as a factory, not TB2::Result::Base directly my $result = Test::Builder2::Result->new_result(%options);
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.
A Result object used as a boolean will be true if the assert passed, false otherwise.
my $name = $result->name;
The name of the assert. For example...
# The name is "addition" ok( 1 + 1, "addition" );
description is the more generic alias to this method.
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.
my $line = $result->line;
The line number upon which this assert was run.
Because a single result can represent a stack of actual asserts, this is generally the location of the first assert in the stack.
id is a more generic alias.
my $file = $result->file;
The file whre this assert was run.
Like line, this represents the top of the assert stack.
my $reason = $result->reason;
The reason for any modifiers.
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.
my $hash = $self->as_hash;
Returns the attributes of a result as a hash reference.
Useful for quickly dumping the contents of a result.
Returns true if the assert passed without regard to any modifiers.
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).
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.
The opposite of is_pass.
Returns true if this result is TODO.
Returns true if the assert was recording as existing but never run.
Test::Builder2::Result Factory for creating results
Test::Builder2::History Store the results
Test::Builder2::Formatter Format results for display
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.