The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::Builder - *DEPRECATED* Module for building testing libraries.

DESCRIPTION

This module was previously the base module for almost any testing library. This module is now little more than a compatability wrapper around Test::Stream. If you are looking to write or update a testing library you should look at Test::Stream::Toolset.

PACKAGE VARS

$Test::Builder::Test

The variable that holds the Test::Builder singleton.

$Test::Builder::Level

In the past this variable was used to track stack depth so that Test::Builder could report the correct line number. If you use Test::Builder this will still work, but in new code it is better to use the Test::Stream::Context module.

METHODS

CONSTRUCTORS

Test::Builder->new

Returns the singleton stored in $Test::Builder::Test.

Test::Builder->create
Test::Builder->create(use_shared => 1)

Returns a new instance of Test::Builder. It is important to note that this instance will not use the shared Test::Stream object unless you pass in the use_shared => 1 argument.

UTIL

$TB->ctx

Helper method for Test::Builder to get a Test::Stream::Context object.

$TB->depth

Get the subtest depth

$TB->find_TODO
$TB->in_todo
$TB->todo

These all check on todo state and value

OTHER

$TB->caller
$TB->carp
$TB->croak

These let you figure out when/where the test is defined in the test file.

$TB->child

Start a subtest (Please do not use this)

$TB->finalize

Finish a subtest (Please do not use this)

$TB->explain

Interface to Data::Dumper that dumps whatever you give it.

$TB->exported_to

This used to tell you what package used Test::Builder, it never worked well. The previous bad and unpredictable behavior of this has largely been preserved, however nothing internal uses it in any meaningful way anymore.

$TB->is_fh

Check if something is a filehandle

$TB->level

Get/Set $Test::Builder::Level. $Level is a package var, and most thigns localize it, so this method is pretty useless.

$TB->maybe_regex

Check if something might be a regex.

$TB->reset

Reset the builder object to a very basic and default state. You almost certainly do not need this unless you are writing a tool to test testing libraries. Even then you probably do not want this.

$TB->todo_end
$TB->todo_start

Start/end TODO state, there are better ways to do this now.

STREAM INTERFACE

These simply interface into functionality of Test::Stream.

$TB->failure_output
$TB->output
$TB->reset_outputs
$TB->todo_output

These get/set the IO handle used in the 'legacy' tap encoding.

$TB->no_diag

Do not display Test::Stream::Event::Diag events.

$TB->no_ending

Do not do some special magic at the end that tells you what went wrong with tests.

$TB->no_header

Do not display the plan

$TB->use_numbers

Turn numbers in TAP on and off.

HISTORY

$TB->details

Get all the events that occured on this object. Each event will be transformed into a hash that matches the legacy output of this method.

$TB->expected_tests

Set/Get expected number of tests

$TB->has_plan

Check if there is a plan

$TB->summary

List of pass/fail results.

EVENT GENERATORS

See Test::Stream::Context, Test::Stream::Toolset, and Test::More::Tools. Calling the methods below is not advised.

$TB->BAILOUT
$TB->BAIL_OUT
$TB->cmp_ok
$TB->current_test
$TB->diag
$TB->done_testing
$TB->is_eq
$TB->is_num
$TB->is_passing
$TB->isnt_eq
$TB->isnt_num
$TB->like
$TB->no_plan
$TB->note
$TB->ok
$TB->plan
$TB->skip
$TB->skip_all
$TB->subtest
$TB->todo_skip
$TB->unlike

ACCESSORS

$TB->stream

Get the stream used by this builder (or the shared stream).

$TB->name

Name of the test

$TB->parent

Parent if this is a child.

MONKEYPATCHING

Many legacy testing modules monkeypatch ok(), plan(), and others. The abillity to monkeypatch these to effect all events of the specified type is now considered discouraged. For backwords compatability monkeypatching continues to work, however in the distant future it will be removed. Test::Stream upon which Test::Builder is now built, provides hooks and API's for doing everything that previously required monkeypatching.

SOURCE

The source code repository for Test::More can be found at http://github.com/Test-More/test-more/.

MAINTAINER

Chad Granum <exodist@cpan.org>

AUTHORS

The following people have all contributed to the Test-More dist (sorted using VIM's sort function).

Chad Granum <exodist@cpan.org>
Fergal Daly <fergal@esatclear.ie>>
Mark Fowler <mark@twoshortplanks.com>
Michael G Schwern <schwern@pobox.com>
唐鳳

COPYRIGHT

There has been a lot of code migration between modules, here are all the original copyrights together:

Test::Stream
Test::Stream::Tester

Copyright 2014 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

Test::Simple
Test::More
Test::Builder

Originally authored by Michael G Schwern <schwern@pobox.com> with much inspiration from Joshua Pritikin's Test module and lots of help from Barrie Slaymaker, Tony Bowden, blackstar.co.uk, chromatic, Fergal Daly and the perl-qa gang.

Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern <schwern@pobox.com>, wardrobe by Calvin Klein.

Copyright 2001-2008 by Michael G Schwern <schwern@pobox.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

Test::use::ok

To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to Test-use-ok.

This work is published from Taiwan.

http://creativecommons.org/publicdomain/zero/1.0

Test::Tester

This module is copyright 2005 Fergal Daly <fergal@esatclear.ie>, some parts are based on other people's work.

Under the same license as Perl itself

See http://www.perl.com/perl/misc/Artistic.html

Test::Builder::Tester

Copyright Mark Fowler <mark@twoshortplanks.com> 2002, 2004.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.