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

NAME

Test::Builder::Tester

SYNOPSIS

  use Test::Builder;
  use Test::Builder::Tester;

  plan 2;

  my $Test = Test::Builder.new();

  test_out( 'ok 1 - Hello' );
  $Test.ok( 1, 'Hello' );
  test_test( 'passing_test );

  test_out( 'not ok 2 - Goodbye' );
  test_diag( "The test failed!" );
  $Test.ok( 0, 'Goodbye' ) || $Test.diag( 'The test failed!' );
  test_test( 'failing test with diagnostics' );

DESCRIPTION

This test module allows you to test test modules that use Test::Builder. It does this by you setting the expected output and diagnostic output of tests, running those tests, and then telling this module to compare the received output to the expected output.

EXPORTED FUNCTIONS

plan( Int $tests )

Plans the number of tests to run. Someday there will be a no_plan version of this too. For now, this is what you have.

test_pass( Str $description )

Marks that the next test should pass. $description is the optional description of the test. This is the easiest way to match a passing test.

test_fail( Str $description )

Marks that the next test should fail. $description is the optional description of the test. This is the easiest way to match a failing test.

test_out( Str $line )

Adds a line to the list of lines of expected output for the test you're going to run.

test_diag( Str $line )

Adds a line to the list of lines of expected diagnostics for the test you're going to run.

test_test( Str $description? )

Compares the receivied and expected lines from the previously run tests, passing if both the diagnostics and output match exactly. If you pass $description, this will use it as the test description.

AUTHOR

based on Test::Tester by Mark Fowler

ported to Perl 6 by chromatic chromatic at wgz dot org