1Test::Assertions::TestSUcsreirptC(o3n)tributed Perl DocuTmeesntt:a:tAisosnertions::TestScript(3)
2
3
4

NAME

6       Test::Assertions::TestScript - Base for test scripts
7

SYNOPSIS

9               use Test::Assertions::TestScript;
10               use Module::To::Test qw( frobnicate );
11
12               ASSERT(frobnicate(),"Frobnicate returns true");
13

DESCRIPTION

15       Test::Assertions::TestScript provides a base for writing test scripts.
16       It performs some common actions such as setting up the @INC path and
17       parsing command-line options, specifically:
18
19       ·   The lib and t/lib directories are added to @INC.
20
21       ·   The current directory is changed to the directory the script is in.
22
23       ·   Test script command-line options are parsed. (See "COMMAND-LINE
24           OPTIONS")
25
26       ·   The test set of functions from Test::Assertions are imported into
27           your test script.
28
29       Test::Assertions::TestScript makes certain assumptions about the
30       filesystem layout of your project:
31
32       ·   Modules that you are testing are in the lib directory of your
33           project.
34
35       ·   Test scripts are in the t directory.
36
37       ·   There may also be a t/lib directory for any modules written for the
38           test process.
39
40       Test::Assertions::TestScript should be "use"d before any modules that
41       you intend to test.
42

OPTIONS

44       Options can be supplied to the import function. These should be placed
45       after the "use" or "import". For example
46
47               use Test::Assertions::TestScript( tests => 10, options => { 'b', \$opt_b })
48
49       The following options are defined:
50
51       tests
52           The number of tests to pass to "plan tests" from Test::Assertions.
53           For example to tell Test::Assertions::TestScript that the script
54           contains 42 tests:
55
56             use Test::Assertions::TestScript tests => 42;
57
58       options
59           A hashref of additional options to capture via Getopt::Long.  The
60           "options" import parameter is passed verbatim to GetOptions, so
61           something along the following lines is required in order to capture
62           the "-b" command line option:
63
64             use Test::Assertions::TestScript( options => { 'b' => \$opt_b } );
65

COMMAND-LINE OPTIONS

67       A script based on Test::Assertions::TestScript will detect the
68       following command line options.
69
70       -t  Shallow tracing. Traces are "print"ed and AutoImport is turned on.
71
72       -T  Deep tracing. Traces are "print"ed and AutoImport is turned on.
73
74       --trace-module=MODULE
75           Imports tracing into MODULE specifically. Can be specified multiple
76           times.
77
78       -s  Save generated output. You will need to write the actual code to do
79           this in your testscript, but you can inspect
80           $Test::Assertions::TestScript::SAVE_OUTPUT to see whether this
81           argument was given.
82
83       Be aware that all other command line options will be disregarded unless
84       the "options" import parameter is used to capture them.
85

VERSION

87       $Revision: 1.18 $
88

AUTHOR

90       Colin Robertson <cpan _at_ bbc _dot_ co _dot_ uk>
91
93       (c) BBC 2005-6. This program is free software; you can redistribute it
94       and/or modify it under the GNU GPL.
95
96       See the file COPYING in this distribution, or
97       http://www.gnu.org/licenses/gpl.txt
98
99
100
101perl v5.32.0                      2020-07-28   Test::Assertions::TestScript(3)
Impressum