Macro: FINISHES

Documentation

Generates a pass if BODY executes to normal completion. In other words if body does signal, return-from or throw this test fails.

Source

(defmacro finishes (&body body)
  "Generates a pass if BODY executes to normal completion. In
other words if body does signal, return-from or throw this test
fails."
  `(let ((ok nil))
     (unwind-protect
	 (progn 
	   ,@body
	   (setf ok t))
       (if ok
	   (add-result 'test-passed :test-expr ',body)
           (process-failure
            :reason (format nil "Test didn't finish")
            :test-expr ',body)))))
Source Context