X-Git-Url: http://git.kpe.io/?p=xlunit.git;a=blobdiff_plain;f=printer.lisp;h=a590a3b79e32825247605d6e52326d6658d8ec7f;hp=8cfeab9f7c3c8aba3a6a28d5fe298b0f9bb9cbdf;hb=HEAD;hpb=b889ac95ba72db60faa35fe08b360aaa33a795ed diff --git a/printer.lisp b/printer.lisp index 8cfeab9..a590a3b 100644 --- a/printer.lisp +++ b/printer.lisp @@ -2,7 +2,7 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; ID: $Id: printer.lisp,v 1.7 2003/08/10 07:39:33 kevin Exp $ +;;;; ID: $Id$ ;;;; Purpose: Printer functions for XLUnit ;;;; ;;;; ************************************************************************* @@ -13,43 +13,43 @@ ;---------------------------------------------------------------------- ; method print-results ;---------------------------------------------------------------------- - + (defmethod print-results ((obj textui-test-runner) result seconds) (print-header obj result seconds) (print-defects obj (errors result) "error") (print-defects obj (failures result) "failure") (print-footer obj result) (values)) - + (defmethod print-header ((obj textui-test-runner) result seconds) (declare (ignore result)) (format (ostream obj) "~&Time: ~D~%~%" (coerce seconds 'float))) - + (defmethod print-defects ((obj textui-test-runner) defects title) (when defects (let ((count (length defects))) (if (= 1 count) - (format (ostream obj) "~%There was 1 ~A:~%" title) + (format (ostream obj) "~%There was 1 ~A:~%" title) (format (ostream obj) "~%There were ~D ~A:~%" - count title)) + count title)) (dotimes (i count) - (let* ((defect (nth i defects)) - (condition (thrown-condition defect))) - (format (ostream obj) "~A) ~A: " - (1+ i) (name (failed-test defect))) - (typecase condition - (assertion-failed - (apply #'format (ostream obj) - (simple-condition-format-control condition) - (simple-condition-format-arguments condition)) - (format (ostream obj) "~%") - (when (message condition) - (let ((spaces (+ 2 (length (format nil "~D" count))))) - (dotimes (i spaces) - (write-char #\space (ostream obj)))) - (format (ostream obj) "~A~%" (message condition)))) - (t - (format (ostream obj) "~A~%" condition)))))))) + (let* ((defect (nth i defects)) + (condition (thrown-condition defect))) + (format (ostream obj) "~A) ~A: " + (1+ i) (name (failed-test defect))) + (typecase condition + (assertion-failed + (apply #'format (ostream obj) + (simple-condition-format-control condition) + (simple-condition-format-arguments condition)) + (format (ostream obj) "~%") + (when (message condition) + (let ((spaces (+ 2 (length (format nil "~D" count))))) + (dotimes (i spaces) + (write-char #\space (ostream obj)))) + (format (ostream obj) "~A~%" (message condition)))) + (t + (format (ostream obj) "~A~%" condition)))))))) (defmethod print-footer ((obj textui-test-runner) result) @@ -66,4 +66,4 @@ (defgeneric summary (result)) (defmethod summary ((result test-results)) (format nil "~D run, ~D erred, ~D failed" - (run-tests result) (error-count result) (failure-count result))) + (run-tests result) (error-count result) (failure-count result)))