From: Thomas M. Hermann Date: Mon, 26 Nov 2012 22:38:43 +0000 (-0600) Subject: Merge branch 'master' into assertion-records X-Git-Tag: 0.9.4~10 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/9ea96f3955a938215b3ee00e1120f83b7a3eb93c Merge branch 'master' into assertion-records Conflicts: lisp-unit.lisp --- 9ea96f3955a938215b3ee00e1120f83b7a3eb93c diff --cc lisp-unit.lisp index 58b8162,e4e2d95..133acd1 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@@ -129,6 -123,57 +129,10 @@@ assertion." (y-or-n-p "~A -- debug?" condition)) (*use-debugger*))) + (defun use-debugger (&optional (flag t)) + "Use the debugger when testing, or not." + (setq *use-debugger* flag)) + -;;; Failure control strings - -(defgeneric print-failure (type form expected actual extras) - (:documentation - "Report the details of the failure assertion.")) - -(defmethod print-failure :around (type form expected actual extras) - "Failure header and footer output." - (format t "~& | Failed Form: ~S" form) - (call-next-method) - (when extras - (format t "~{~& | ~S => ~S~}~%" (funcall extras))) - (format t "~& |~%") - type) - -(defmethod print-failure (type form expected actual extras) - (format t "~& | Expected ~{~S~^; ~} " expected) - (format t "~<~% | ~:;but saw ~{~S~^; ~}~>" actual)) - -(defmethod print-failure ((type (eql :error)) - form expected actual extras) - (format t "~& | ~@[Should have signalled ~{~S~^; ~} but saw~]" - expected) - (format t " ~{~S~^; ~}" actual)) - -(defmethod print-failure ((type (eql :macro)) - form expected actual extras) - (format t "~& | Should have expanded to ~{~S~^; ~} " expected) - (format t "~<~%~:;but saw ~{~S~^; ~}~>" actual)) - -(defmethod print-failure ((type (eql :output)) - form expected actual extras) - (format t "~& | Should have printed ~{~S~^; ~} " expected) - (format t "~<~%~:;but saw ~{~S~^; ~}~>" actual)) - -(defun print-error (condition) - "Print the error condition." - (let ((*print-escape* nil)) - (format t "~& | Execution error:~% | ~W" condition) - (format t "~& |~%"))) - -(defun print-summary (name pass fail &optional exerr) - "Print a summary of the test results." - (format t "~&~A: ~S assertions passed, ~S failed" - name pass fail) - (format t "~@[, ~S execution errors~].~2%" exerr)) - ;;; Global unit test database (defparameter *test-db* (make-hash-table :test #'eq)