A backend for building test libraries under Perl. Note that Test::Builder is in the early stages of development and that things may become more (or less) stable, or may change completely. Test::Builder is more flexible than other testing modules such as Test::Simple and Test::More.
Test::Builder implements the following methods.
new |
new()
Returns a Test::Builder object representing the current state of the test. There's no need to create more than one Test::Builder object, since you run only one test per program.
BAILOUT |
BAILOUT(reason)
Terminates all tests and exits immediately.
expected_tests |
expected_tests()
Gets and sets the tests that will run and prints out the correct headers.
exported_to |
exported_to(package)
Specifies the package you exported your functions to.
is_eq |
is_eq(got_from_test, expected_from_test, name_of_test)
Checks if got_from_testeq expected_from_test.
isnt_eq |
isnt_eq(got_from_test, did_not_expect, name_of_test)
Checks if got_from_testne did_not_expect.
isnt_num |
isnt_num(got_from_test, did_not_expect, name_of_test)
Checks if got_from_test!= did_not_expect.
is_num |
is_num(got_from_test, expected_from_test, name_of_test)
Checks if got_from_test== expected_from_test.
like |
like(string, '/regex/', name_of_test)
Checks if string matches the specified regular expression.
no_plan |
no_plan()
Declares that there may be an infinite number of tests.
ok |
ok(test, name)
Reports if test by name is true.
plan |
plan()
Sets up the tests for you, prints appropriate headers, and takes appropriate actions. plan can be used in lieu of any of the subsequent methods.
skip |
skip([reason])
Skips the current test, citing reason.
skip_all |
skip_all(reason)
Shamelessly skips all the tests, citing the given reason . Exits with 0.
my $reason = "I didn't feel like it today."; $Test->skip_all($reason);
unlike |
unlike(string, '/regex/', name_of_test)
Checks if string does not match the specified regular expression.
Copyright © 2002 O'Reilly & Associates. All rights reserved.