X-Git-Url: http://git.kpe.io/?p=xlunit.git;a=blobdiff_plain;f=tcase.lisp;h=7aefbddd639047b90c1c63b3efac3196bc59777e;hp=3d68142afba33e56f6b0f2cee2fc6040f6dbc77d;hb=HEAD;hpb=6e195606e06173086a91616042adef3072633d92 diff --git a/tcase.lisp b/tcase.lisp index 3d68142..7aefbdd 100644 --- a/tcase.lisp +++ b/tcase.lisp @@ -2,7 +2,7 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; ID: $Id: tcase.lisp,v 1.2 2003/08/04 19:31:34 kevin Exp $ +;;;; ID: $Id$ ;;;; Purpose: Test fixtures for XLUnit ;;;; ;;;; ************************************************************************* @@ -15,17 +15,17 @@ (defclass test-case (test) ((existing-suites :initform nil :accessor existing-suites - :allocation :class) + :allocation :class) (method-body :initarg :method-body :accessor method-body :initform nil :documentation "A function designator which will be applied to this instance to perform that test-case.") (name :initarg :name :reader name :initform "" - :documentation "The name of this test-case, used in reports.") + :documentation "The name of this test-case, used in reports.") (description :initarg :description :reader description - :documentation - "Short description of this test-case, uses in reports") + :documentation + "Short description of this test-case, uses in reports") (suite :initform nil :accessor suite :initarg :suite)) (:documentation "Base class for test-cases.")) @@ -38,7 +38,7 @@ to perform that test-case.") (setf (gethash (type-of ob) (existing-suites ob)) (make-instance 'test-suite))) ;;specifi suite singleton (setf (suite ob) (gethash (type-of ob) (existing-suites ob)))) - + (defgeneric set-up (test) (:documentation @@ -59,11 +59,11 @@ that the setup method did for this instance.")) (defmethod run ((ob test) &key (handle-errors t)) "Generalized to work on test-case and test-suites" (let ((res (make-test-results))) - (run-on-test-results ob res :handle-errors t) + (run-on-test-results ob res :handle-errors handle-errors) res)) (defmethod run-on-test-results ((test test-case) result - &key (handle-errors t)) + &key (handle-errors t)) (start-test test result) (run-protected test result :handle-errors handle-errors) (end-test test result)) @@ -78,14 +78,12 @@ that the setup method did for this instance.")) (funcall (method-body test))) (defmethod run-protected ((test test-case) res &key (handle-errors t)) - (handler-case - (run-base test) - (assertion-failed (condition) - (add-failure res test condition)) - (serious-condition (condition) - (add-error res test condition))) + (if handle-errors + (handler-case + (run-base test) + (assertion-failed (condition) + (add-failure res test condition)) + (serious-condition (condition) + (add-error res test condition))) + (run-base test)) res) - - - -