1Test::Regression(3)   User Contributed Perl Documentation  Test::Regression(3)
2
3
4

NAME

6       Test::Regression - Test library that can be run in two modes; one to
7       generate outputs and a second to compare against them
8

VERSION

10       Version 0.08
11

SYNOPSIS

13         use Test::Regression;
14
15         ok_regression(sub {return "hello world"}, "t/out/hello_world.txt");
16

DESCRIPTION

18       Using the various Test:: modules you can compare the output of a
19       function against what you expect. However if the output is complex and
20       changes from version to version, maintenance of the expected output
21       could be costly. This module allows one to use the test code to
22       generate the expected output, so that if the differences with model
23       output are expected, one can easily refresh the model output.
24

EXPORT

26       ok_regression
27

FUNCTIONS

29   ok_regression
30       This function requires two arguments: a CODE ref and a file path. The
31       CODE ref is expected to return a SCALAR string which can be compared
32       against previous runs. If the TEST_REGRESSION_GEN is set to a true
33       value, then the CODE ref is run and the output written to the file.
34       Otherwise the output of the file is compared against the contents of
35       the file.  There is a third optional argument which is the test name.
36

ENVIRONMENT VARIABLES

38   TEST_REGRESSION_GEN
39       If the TEST_REGRESSION_GEN environment file is unset or false in a perl
40       sense, then the named output files must exist and be readable and the
41       test will run normally comparing the outputs of the CODE refs against
42       the contents of those files. If the environment variable is true in a
43       perl sense, then model output files will be overwritten with the output
44       of the CODE ref.
45

AUTHOR

47       Nicholas Bamber, "<nicholas at periapt.co.uk>"
48

BUGS

50       Please report any bugs or feature requests to "bug-test-regression at
51       rt.cpan.org", or through the web interface at
52       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Regression>.  I
53       will be notified, and then you'll automatically be notified of progress
54       on your bug as I make changes.
55
56   testing of STDERR
57       The testing of stderr from this module is not as thorough as I would
58       like.  Test::Builder::Tester allows turning off of stderr checking but
59       not matching by regular expression. Handcrafted efforts currently fall
60       foul of Test::Harness. Still it is I believe adequately tested in terms
61       of coverage.
62

SUPPORT

64       You can find documentation for this module with the perldoc command.
65
66           perldoc Test::Regression
67
68       You can also look for information at:
69
70       •   RT: CPAN's request tracker
71
72           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Regression>
73
74       •   AnnoCPAN: Annotated CPAN documentation
75
76           <http://annocpan.org/dist/Test-Regression>
77
78       •   CPAN Ratings
79
80           <http://cpanratings.perl.org/d/Test-Regression>
81
82       •   Search CPAN
83
84           <http://search.cpan.org/dist/Test-Regression/>
85

ACKNOWLEDGEMENTS

87       Some documentation improvements have been suggested by toolic
88       (http://perlmonks.org/?node_id=622051).
89       Thanks to Filip GraliXski for pointing out I need to test against
90       output of zero length and providing a patch.
91       Thanks to Christian Walde for pestering me about newline Windows
92       compatibility issues and for providing a patch.
93
95       Copyright 2009-10 Nicholas Bamber.
96
97       This program is free software; you can redistribute it and/or modify it
98       under the terms of either: the GNU General Public License as published
99       by the Free Software Foundation; or the Artistic License.
100
101       See http://dev.perl.org/licenses/ for more information.
102

POD ERRORS

104       Hey! The above document had some coding errors, which are explained
105       below:
106
107       Around line 157:
108           Non-ASCII character seen before =encoding in 'GraliXski'. Assuming
109           UTF-8
110
111
112
113perl v5.36.0                      2022-07-22               Test::Regression(3)
Impressum