Variable | Package: util.test | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## *error-protect-tests*

This variable has no effect when test code is compiled. When test code is not compiled, then if the value of this variable is true, each test is protected from errors. If an error occurs, then that will be taken as a test failure unless test-error is being used. If the value of this variable is `nil`, then if an error occurs (except in a test-error form), an error is signaled and a break loop is entered.

    cl-user(17): (defun foo ()
                    (util.test:test 1 (+ 0 "1")))
    cl-user(18): (foo)
    Error: `"1"' is not of the expected type `number'
      [condition type: type-error]
    [1] cl-user(19): :res
    ;; When *ERROR-PROTECT-TESTS* is NIL, tests are not protected:
    cl-user(20): (let ((util.test:*error-protect-tests* nil))
    	       (foo))
    Error: `"1"' is not of the expected type `number'
      [condition type: type-error]
    [1] cl-user(21): :res
    ;; When *ERROR-PROTECT-TESTS* is T and the test code is not
    ;; compiled, tests are protected:
    cl-user(22): (let ((util.test:*error-protect-tests* t))
    	       (foo))
    Condition type: TYPE-ERROR
    Message: `"1"' is not of the expected type `number'
     * * * UNEXPECTED TEST FAILURE * * *
    Test failed: (+ 0 "1")
    Reason: an error (of type TYPE-ERROR) was detected.
    nil
    ;; But when we compile FOO, binding *ERROR-PROTECT-TESTS*
    ;; to T has no effect:
    cl-user(23): (compile 'foo)
    foo
    cl-user(24): (let ((util.test:*error-protect-tests* t))
    	       (foo))
    Error: `"1"' is not of the expected type `number'
      [condition type: TYPE-ERROR]
    [1] cl-user(25):

See test-harness.htm for information on the Allegro CL test harness.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version