☺唐鳳☻
and 1 contributors

NAME

Test::Builder::Test

SYNOPSIS

  use Test::Builder::Test;

DESCRIPTION

The Test::Builder::Test class represents a single test within the Test::Builder framework. The class itself is actually a factory for classes which does the Test::Builder::Test::Base role.

METHODS

new

This is a Factory method used to create a specific class instances which perform the Test::Builder::Test::Base role.

$number

This is the test number.

$passed = 1

This parameter defaults to true, and so the factory returns a Test::Builder::Test::Pass instance, passing on the $description parameter, and setting the passed parameter to a true value.

If this parameter is false, the factory returns a Test::Builder::Test::Fail instance, passing on the $description parameter and setting the passed parameter to a false value.

?$skip = 0

This parameter defaults to false. If it is true, the factory returns a Test::Builder::Test::Skip instance, passing on the $description and $reason parameters and a true value for the passed parameter.

?$todo = 0

This parameter defaults to false. If it is true, the factory returns a Test::Builder::Test::TODO instance, passing on the $description, $reason, and $passed parameters.

?$reason = ''

This parameter is for the skip and TODO tests and should contain a string describing why the test is a skip or TODO test.

?$description = ''

This parameter and contains the test description.

ROLES

Test::Builder::Test::Base

This role contains several public attributes.

Bool $.passed

Whether the test passed.

Int $.number

The number of the test in the current test file.

Str $.description

The test's description (optional).

Str $.diagnostic

The test's diagnostic message (optional).

This role contains two methods:

status returns Hash

This returns a hash containing two keys, passed and description, from the test's attributes.

report returns Str

This returns a string which follows the TAP protocol:

  ok 1 - test description
  not ok 2 - test description
  # test diagnoistic
Test::Builder::Test::WithReason

This role extends the Test::Builder::Test::Base role to add a simple public attribute.

Str $.reason

It also overrides a single method:

status returns Hash

This method calls the superclass status method and adds the values of the test's skip and reason attributes to the hash before returning it.

OTHER CLASSES

    These first two classes perform the Test::Builder::Test::Base role.

    Test::Builder::Test::Pass

    Test::Builder::Test::Fail

    These next two classes both perform the Test::Builder::Test::WithReason role and override some methods to provide additional features.

    Test::Builder::Test::TODO

    This overrides two methods.

    report returns Str

    This handles the specific details of TAP output for TODO tests.

    status returns Hash

    This adds a TODO key, sets the passed key to true, and adds a really_passed key which contains the boolean representing if the test truly did pass.

    Test::Builder::Test::Skip

    This also overrides two methods.

    report returns Str

    This handles the specific details of TAP output for Skip tests.

    status returns Hash

    This sets the skip key to true in the hash.

SEE ALSO

Perl 5 Test::Builder and Test::Harness::TAP.

AUTHORS

code by chromatic <chromatic@wgz.org>

documentation by Stevan Little <stevan@iinteractive.com> and chromatic.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 256:

You can't have =items (as at line 260) unless the first thing after the =over is an =item