.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::Assertions::TestScript 3pm" .TH Test::Assertions::TestScript 3pm "2015-12-22" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Test::Assertions::TestScript \- Base for test scripts .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Test::Assertions::TestScript; \& use Module::To::Test qw( frobnicate ); \& \& ASSERT(frobnicate(),"Frobnicate returns true"); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Test::Assertions::TestScript provides a base for writing test scripts. It performs some common actions such as setting up the \f(CW@INC\fR path and parsing command-line options, specifically: .IP "\(bu" 4 The lib and t/lib directories are added to \f(CW@INC\fR. .IP "\(bu" 4 The current directory is changed to the directory the script is in. .IP "\(bu" 4 Test script command-line options are parsed. (See \*(L"COMMAND-LINE \s-1OPTIONS\*(R"\s0) .IP "\(bu" 4 The test set of functions from Test::Assertions are imported into your test script. .PP Test::Assertions::TestScript makes certain assumptions about the filesystem layout of your project: .IP "\(bu" 4 Modules that you are testing are in the lib directory of your project. .IP "\(bu" 4 Test scripts are in the t directory. .IP "\(bu" 4 There may also be a t/lib directory for any modules written for the test process. .PP Test::Assertions::TestScript should be \f(CW\*(C`use\*(C'\fRd \fBbefore\fR any modules that you intend to test. .SH "OPTIONS" .IX Header "OPTIONS" Options can be supplied to the import function. These should be placed after the \f(CW\*(C`use\*(C'\fR or \f(CW\*(C`import\*(C'\fR. For example .PP .Vb 1 \& use Test::Assertions::TestScript( tests => 10, options => { \*(Aqb\*(Aq, \e$opt_b }) .Ve .PP The following options are defined: .IP "tests" 4 .IX Item "tests" The number of tests to pass to \f(CW\*(C`plan tests\*(C'\fR from Test::Assertions. For example to tell Test::Assertions::TestScript that the script contains 42 tests: .Sp .Vb 1 \& use Test::Assertions::TestScript tests => 42; .Ve .IP "options" 4 .IX Item "options" A hashref of additional options to capture via Getopt::Long. The \*(L"options\*(R" import parameter is passed verbatim to GetOptions, so something along the following lines is required in order to capture the \*(L"\-b\*(R" command line option: .Sp .Vb 1 \& use Test::Assertions::TestScript( options => { \*(Aqb\*(Aq => \e$opt_b } ); .Ve .SH "COMMAND-LINE OPTIONS" .IX Header "COMMAND-LINE OPTIONS" A script based on Test::Assertions::TestScript will detect the following command line options. .IP "\-t" 4 .IX Item "-t" Shallow tracing. Traces are \f(CW\*(C`print\*(C'\fRed and AutoImport is turned on. .IP "\-T" 4 .IX Item "-T" Deep tracing. Traces are \f(CW\*(C`print\*(C'\fRed and AutoImport is turned on. .IP "\-\-trace\-module=MODULE" 4 .IX Item "--trace-module=MODULE" Imports tracing into \s-1MODULE\s0 specifically. Can be specified multiple times. .IP "\-s" 4 .IX Item "-s" Save generated output. You will need to write the actual code to do this in your testscript, but you can inspect \f(CW$Test::Assertions::TestScript::SAVE_OUTPUT\fR to see whether this argument was given. .PP Be aware that all other command line options will be disregarded unless the \&\f(CW\*(C`options\*(C'\fR import parameter is used to capture them. .SH "VERSION" .IX Header "VERSION" \&\f(CW$Revision:\fR 1.18 $ .SH "AUTHOR" .IX Header "AUTHOR" Colin Robertson .SH "COPYRIGHT" .IX Header "COPYRIGHT" (c) \s-1BBC 2005\-6.\s0 This program is free software; you can redistribute it and/or modify it under the \s-1GNU GPL.\s0 .PP See the file \s-1COPYING\s0 in this distribution, or http://www.gnu.org/licenses/gpl.txt