Variable | Package: util.test | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version