|testscript_ok($source, $plan, $name)||
A test predicate for checking that a test script acts as expected. Runs
the script capturing STDOUT and STDERR and fails if anything unexpected
The expected behavior of the script is defined by calling want_test() from within the script, just before running each test.
$source is the body of the test script, as a single multi-line string.
$plan is the number of tests that the test script will run.
$name is a name for this test.
Some code will be prepended to $source, to make the want_test() and fail_diag() functions available and to set the test plan to $plan.
Tip: include a #line directive in your script source as shown in the SYNOPSIS above, so that the reported line numbers for problems will point to the correct line in your source file.
The following functions are for use from within the script under test. They are not exported by default.
want_test($type, $name, @diag) Declares that the next test will pass or fail or be skipped according to $type, will have name $name and will produce the diagnostic output lines listed in @diag.
$type must be one of the strings pass, fail, skip. $name can be undef for a test without a name. The elements of @diag can be strings for an exact match, or regular expressions prefixed with / or compiled with qr//.
Note that diagnostic lines consist of a hash character followed by a space and then the diagnostic message. The strings and patterns passed to want_test() must include this prefix.
fail_diag($test_name [,$from_test_builder] [,$line] [,$file]) Call only in a list context, and pass the results to want_test() as diagnostic line patterns.
Returns the diagnostic line pattern(s) to match output from a failed test. $test_name is the name of the test, or undef for a nameless test. $line should be defined only if a file and line diagnostic is expected, and should give the expected line number. $file is the filename for the failed test diagnostic, it defaults to the current file.
$from_test_builder should be true if Test::Builder will produce the diagnostic, false if the diagnostic will come from Test::Group. The expected text will be adjusted according to the version of Test::Builder or Test::Group in use.
Nick Cleaton <email@example.com>
Dominique Quatravaux <firstname.lastname@example.org>
Copyright (c) 2009 by Nick Cleaton and Dominique Quatravaux
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.1 or, at your option, any later version of Perl 5 you may have available.
|perl v5.20.3||TEST::GROUP::TESTER (3)||2016-04-04|