NAME

TB2::Formatter::TAP::Base - Base class for TAP formatters

SYNOPSIS

package My::TAP::Formatter;

use TB2::Mouse;
extends 'TB2::Formatter::TAP::Base';

...whatever extensions you like...

DESCRIPTION

The base class for formatting output using the Test Anything Protocol.

In reality it is fully functional, but we highly encourage you to use a version specific subclass.

TB2::Formatter::TAP::v13 for TAP version 13 TB2::Formatter::TAP::v12 for TAP version 12

As TAP is further extended, there will be more formatters to choose from.

The TB2::Formatter::TAP factory will choose the latest TAP version.

METHODS

As TB2::Formatter with the following changes and additions.

out

err

These methods are just shorthand for:

$output->write(out => @args);
$output->write(err => @args);

diag

$tap->diag( @text );

Outputs @text as a TAP comment to the error handle.

note

Like diag but goes to the output handle.

use_numbers

my $use_numbers = $formatter->use_numbers;
$formatter->use_numbers($use_numbers);

Get/sets if the TAP output should include the test number. Defaults to true. NOTE: the counter will still incrememnt this only toggles if the number should be used in the display.

handle_result

Takes a TB2::Result as an argument and displays the result details.

comment

my $comment = $self->comment(@message);

Will turn the given @message into a TAP comment.

# returns "# Basset houndsgot long ears"
$self->comment("Basset hounds", "got long ears");

SEE ALSO

TB2::Formatter::TAP::v12 TB2::Formatter::TAP::v13 TB2::Formatter::TAP TB2::Formatter