From: Thomas M. Hermann Date: Thu, 22 Nov 2012 19:22:55 +0000 (-0600) Subject: Update print-failure to work with result objects. X-Git-Tag: 0.9.4~19 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/8f5907772e2f42877ede975f104a061ee9a79526 Update print-failure to work with result objects. --- diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 16ad025..d136332 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -513,8 +513,11 @@ assertion.") (name test-result) (length (pass test-result)) (length (fail test-result))) - (format t "~@[, ~S execution errors~].~2%" - (exerr test-result))) + (if (exerr test-result) + (format t ", and an execution error.") + (write-char #\.)) + (terpri) + (terpri)) (defun run-code (code) "Run the code to test the assertions." @@ -676,7 +679,7 @@ assertion.") (format t "~{~& | ~S => ~S~}~%" (funcall (extras result)))) (format t "~& |~%") - (class-name result)) + (class-name (class-of result))) (defmethod print-failure ((result assert-result)) (format t "~& | Expected ~{~S~^; ~} " (expected result)) @@ -698,6 +701,19 @@ assertion.") (format t "~<~%~:;but saw ~{~S~^; ~}~>" (actual result))) +(defmethod print-failure ((result test-result)) + "Print the failed assertions in the unit test." + (loop for fail in (fail result) do + (print-failure fail) + finally + (print-summary result))) + +(defmethod print-failure ((results test-results-db)) + "Print all of the failure tests." + (loop with db = (database results) + for test in (failed-tests results) do + (print-failure (gethash test db)))) + ;;; Print errors (defgeneric print-error (result)