Next: , Previous: , Up: testing   [Contents][Index]


23.4 Running test functions

Function: dotest-final-report

This function must be invoked as last command in the test file to report errors and correctly exit the test script (in a way compatible with the requirements of GNU Automake).

Function: dotest pattern

Run all the functions matching pattern. Usually pattern is the first part of the name of the functions to be executed; the function names are selected with the following code:

compgen -A function pattern

There’s no constraint on function names, but they must be one–word names.

Before running a test function: the current process working directory is saved, and it is restored after the execution is terminated.

The return value of the test functions is used as result of the test: true, the test succeeded; false, the test failed. Remembering that the return value of a function is the return value of its last executed command, the functions dotest-equal() and dotest-output(), and of course the test command, may be used to return the correct value.

Messages are printed before and after the execution of each function, according to the mode selected with: dotest-set-report-success(), dotest-set-report-start(), … Configuring the package

The following environment variables will influence the behaviour of dotest().

Variable: TESTMATCH

Restrict the pattern argument to dotest(). First function names are matched against pattern, then, the ones that match, are matched against TESTMATCH.

Variable: TESTSTART

If yes: It is equivalent to invoking dotest-set-report-start(). If no: It is equivalent to invoking dotest-unset-report-start().

Variable: TESTSUCCESS

If yes: It is equivalent to invoking dotest-set-report-success(). If no: It is equivalent to invoking dotest-unset-report-success().


Next: , Previous: , Up: testing   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.