Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.140 Term::ReadLineChapter 8
Standard Modules
Next: 8.142 Test::Harness
 

8.141 Test

Provides a framework for writing test scripts so you don't need to know the particular output that Test::Harness expects to see. Useful if you are writing modules and writing tests for those modules. Provides the following test types:

Normal

Tests that are expected to succeed.

Skip

Tests that need a platform-specific feature. They work like normal tests except that the first argument should evaluate to true if the required feature is not present.

Todo

Tests that are designed for maintaining an executable todo list; the tests aren't expected to succeed.

Test also provides an onfail hook that can trigger additional diagnostics for failures at the end of the test run. To use onfail, pass it an array reference of hash references where each hash contains at least these fields: package, repetition, and result, as well as any expected value or diagnostic string.

See the Test manpage for details and examples.


Previous: 8.140 Term::ReadLinePerl in a NutshellNext: 8.142 Test::Harness
8.140 Term::ReadLineBook Index8.142 Test::Harness