0.9.8.41:
[sbcl.git] / tests / test-util.lisp
index 00a986d..e49c627 100644 (file)
 (defvar *break-on-expected-failure* nil)
 
 (defmacro with-test ((&key fails-on name) &body body)
-  `(handler-case (progn
-                   (start-test)
-                   ,@body
-                   (when (expected-failure-p ,fails-on)
-                     (fail-test :unexpected-success ',name nil)))
-    (error (error)
-     (if (expected-failure-p ,fails-on)
-         (fail-test :expected-failure ',name error)
-         (fail-test :unexpected-failure ',name error)))))
+  (let ((block-name (gensym)))
+    `(block ,block-name
+       (handler-bind ((error (lambda (error)
+                               (if (expected-failure-p ,fails-on)
+                                   (fail-test :expected-failure ',name error)
+                                   (fail-test :unexpected-failure ',name error))
+                               (return-from ,block-name))))
+         (progn
+           (start-test)
+           ,@body
+           (when (expected-failure-p ,fails-on)
+             (fail-test :unexpected-success ',name nil)))))))
 
 (defun report-test-status ()
-  (with-standard-io-syntax 
+  (with-standard-io-syntax
       (with-open-file (stream "test-status.lisp-expr"
                               :direction :output
                               :if-exists :supersede)
@@ -36,7 +39,7 @@
     (setf *test-count* 0))
   (incf *test-count*))
 
-(defun fail-test (type test-name condition)  
+(defun fail-test (type test-name condition)
   (push (list type *test-file* (or test-name *test-count*))
         *failures*)
   (when (or (and *break-on-failure*