B - easy creation of test scripts


Test::Helper - easy creation of test scripts


 use Test::Helper;
 test {
   comm 'Doing first part of test';
   ok $variable==$correct_value;
   ok not runs {this_should_die()};


Enclose the body of your test script within a test block. Within that block, run individual tests with the ok function, which should be passed a scalar that you desire to be true; this will print ``ok number'' or ``not ok number'' as appropriate. Similarly, the runs command will expect its body not to signal an error when run; use it with ok, negated or not. Note that the test block keeps track of how many tests there are and outputs the first line accordingly (it stores up the messages); if an uncaught exception is raised within the body, it simulates one last failed test and propagates the exception in order to ensure that it is counted as a failure. comm just writes out a comment to the standard output where it will be visible in verbose testing mode. syntax_check checks the syntax of modules and scripts listed in the MANIFEST.


See the Test::Harness(3) manpage, for how test scripts are run; and the ExtUtils::MakeMaker(3) manpage, for where to put test scripts (usually as files t/*.t) in a distribution.


Jesse Glick, jglick@sig.bsh.com


last modified $Date$. Release $TestHelperRelease$. $Copyright$``$> Test-Helper/lib/Test/Helper.pm last modified Fri, 05 Sep 1997 16:08:15 -0400. Release 0.002. Copyright (c) 1997 Strategic Interactive Group. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

 B - easy creation of test scripts