Next Previous Contents

4. Function Reference

4.1 tess_auto_summarize

Synopsis

Turn automatic test suite summarization on or off

Usage

tess_add_eval_paths( [0 | 1.])

Description
Notes
See Also

tess_summary

4.2 tess_add_eval_paths

Synopsis

Add one or more directories to the S-Lang evalfile() search path

Usage

tess_add_eval_paths( path1, [path2, ...])

Description

This function is a convenience wrapper around the set_slang_load_path() function, making it cleaner and simpler to augment the list of directories searched by the S-Lang interpreter when evalfile() is invoked with an ambiguous file specification.

Notes

TESS automatically appends the current working directory, as well as ../src, ../share, and ../packages to the load path.

See Also

tess_add_import_paths

4.3 tess_add_import_paths

Synopsis

Add one or more directories to the S-Lang import() search path

Usage

tess_add_import_paths( path1, [path2, ...])

Description

This function is a convenience wrapper around the set_import_module_path() function, making it cleaner and simpler to augment the list of directories searched by the S-Lang interpreter when import() is invoked.

Notes

TESS automatically appends ../src to the import path.

See Also

tess_add_eval_paths

4.4 tess_catch_type_errors

Synopsis

Give S-Lang ERROR block mechanism the ability to catch type mismatch errors

Usage

tess_catch_type_errors( [yes_or_no] )

Description

This function augments the S-Lang ERROR block mechanism, giving it the ability to catch type mismatch exceptions (which S-Lang 1.x formally considers uncatchably fatal). This feature is useful for a test framework, since it allows functions to be safely exercised against a wide variety of types.

If the first passed argument evaluates to a boolean TRUE then the function will enable type error catching. If either zero arguments are passed, or the first argument evaluates to boolean FALSE, then type error catching will be disabled.

Notes

This function is deprecated, as in S-Lang 2 all exceptions may be caught.

See Also

tess_invoke

4.5 tess_invoke

Synopsis

Execute a test case

Usage

tess_invoke( expected_to_fail, function_ref [, arg1, arg2, ...])

Description

Invoke the given function (by dereference), optionally passing in one or more arguments. The first parameter, whose value should be either zero or one, indicates whether the function is expected to signal an error when invoked in the manner given.

If the actual result of the call matches the expected result then the test case is said to "pass," otherwise it is said to "fail". It is important to understand this: a failed test case is not indicated by an error signal itself, but rather by whether or not the test case expected an error to be signaled.

Notes
See Also

tess_catch_type_errors, tess_summary

4.6 tess_load_component

Synopsis

Evaluate the named S-Lang script, and set the test component name accordingly

Usage

tess_load_component(filename)

Description

This function attempts to evalfile() the named script, using the usual S-Lang load mechansism, and will set the TESS test component name to the filename if found.

The test component name is printed in the heading of results summaries, and uniquely identifies a given test script. Typically the test component name is set to the "basename" of the test script itself (e.g. a script add.t sets Component = "add"). This function provides a means of customizing that default behavior while loading additional functionality to be exercised within the test script.

Notes
See Also

4.7 tess_summary

Synopsis

Summarize the results of a suite of tests

Usage

Integer_Type tess_summary()

Description

TESS automatically records the pass/fail result of each test case executed by tess_invoke. By default the results of this tally are emitted to stdout when tess_summary is called, although this may be disabled by calling tess_auto_summarize(0). The return value indicates the number of failed tests.

Notes

Under normal circumstances it should not be necessary to call this function explicitly, since TESS transparently installs an exit handler which calls tess_summary at application termination. Its return value is then passed to the operating so that, for example, a non-zero status may be used to fatally terminate a "make test" goal.

See Also

tess_invoke


Next Previous Contents