From 3340c363f7eaf1e7059ea33f9d2edd72f028d1ac Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Thu, 16 Aug 2018 14:08:53 +0200 Subject: [PATCH 1/5] updated some diagnostic messages # Conflicts: # lisp-unit.lisp --- lisp-unit.lisp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 317a69f..b3e3af3 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -281,6 +281,7 @@ assertion.") (defmacro define-test (name &body body) "Store the test in the test database." + (format t "defining test ~A~%" name) (let ((qname (gensym "NAME-"))) (multiple-value-bind (doc tag code) (parse-body body) `(let* ((,qname (valid-test-name ',name)) @@ -783,6 +784,7 @@ assertion.") (defun record-result (test-name code results) "Run the test code and record the result." + (format t "Beginning test ~A~%" test-name) (let ((result (run-test-thunk test-name code))) ;; Store the result (setf (gethash test-name (database results)) result) From 3bfb6b5124dac2cb29572e5f95d0d595f82f79e8 Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Fri, 20 Jul 2018 15:10:15 +0200 Subject: [PATCH 2/5] list failing and error tests in the summary --- lisp-unit.lisp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index b3e3af3..e66c6fb 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -810,6 +810,12 @@ assertion.") "Print a summary of all results to the stream." (let ((pass (pass results)) (fail (fail results))) + (maphash (lambda (test-name result) + (when (fail result) + (format stream " | failed: ~A~%" test-name))) (database results)) + (maphash (lambda (test-name result) + (when (exerr result) + (format stream " | error: ~A~%" test-name))) (database results)) (format stream "~&Unit Test Summary~%") (format stream " | ~D assertions total~%" (+ pass fail)) (format stream " | ~D passed~%" pass) From 396c3661aa082f672f2e1ec25164c99166bbe296 Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Thu, 16 Aug 2018 14:14:33 +0200 Subject: [PATCH 3/5] added timing message to diagnostic when running a test --- lisp-unit.lisp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index e66c6fb..45dd2a6 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -924,7 +924,12 @@ If MERGE is NIL, then an error is signalled when a conflict occurs." for test-name being each hash-key in table using (hash-value unit-test) if unit-test do - (record-result test-name (code unit-test) results) + (let ((start-time (get-internal-real-time))) + (prog2 (format t "~A ~A~%" package test-name) + (record-result test-name (code unit-test) results) + (format t "~A ~A ~F seconds~%~%" package test-name + (/ (- (get-internal-real-time) start-time) + internal-time-units-per-second)))) else do (push test-name (missing-tests results)) ;; Summarize and return the test results @@ -943,7 +948,12 @@ If MERGE is NIL, then an error is signalled when a conflict occurs." for test-name in test-names as unit-test = (gethash test-name table) if unit-test do - (record-result test-name (code unit-test) results) + (let ((start-time (get-internal-real-time))) + (prog2 (format t "~A ~A~%" package test-name) + (record-result test-name (code unit-test) results) + (format t "~A ~A ~F seconds~%~%" package test-name + (/ (- (get-internal-real-time) start-time) + internal-time-units-per-second)))) else do (push test-name (missing-tests results)) finally @@ -977,7 +987,7 @@ If MERGE is NIL, then an error is signalled when a conflict occurs." (format stream "~& | Failed Form: ~S" (form result)) (call-next-method) (when (extras result) - (format stream "~{~& | ~S => ~S~}~%" (extras result))) + (format stream "~{~& | ~S ~% => ~S~}~%" (extras result))) (format stream "~& |~%")) (defmethod print-failures ((result failure-result) &optional From cae914eee666b92ceb3d519a6a8a7f5c281fe0fc Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Thu, 16 Aug 2018 14:45:54 +0200 Subject: [PATCH 4/5] this commit fixes #47 --- lisp-unit.lisp | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 45dd2a6..d1fb5bc 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -810,6 +810,7 @@ assertion.") "Print a summary of all results to the stream." (let ((pass (pass results)) (fail (fail results))) + ;; fixing issue #47 (maphash (lambda (test-name result) (when (fail result) (format stream " | failed: ~A~%" test-name))) (database results)) From 6e3b4229bba496a2cc53e7060daccf692ba1933f Mon Sep 17 00:00:00 2001 From: Jim Newton Date: Thu, 16 Aug 2018 14:47:13 +0200 Subject: [PATCH 5/5] this commit fixes #48 --- lisp-unit.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index d1fb5bc..6be32b3 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -810,7 +810,7 @@ assertion.") "Print a summary of all results to the stream." (let ((pass (pass results)) (fail (fail results))) - ;; fixing issue #47 + ;; fixing issue #48 (maphash (lambda (test-name result) (when (fail result) (format stream " | failed: ~A~%" test-name))) (database results))