From: Olof-Joachim Frahm Date: Tue, 6 Jan 2015 15:25:59 +0000 (+0000) Subject: Indicate test failures with return value. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=ea9fe5771807138bc553a2f669ef1aa4540e4fdc;p=fiveam.git Indicate test failures with return value. --- diff --git a/src/run.lisp b/src/run.lisp index fcb35db..e40a316 100644 --- a/src/run.lisp +++ b/src/run.lisp @@ -234,8 +234,10 @@ run.")) (defun explain! (result-list) "Explain the results of RESULT-LIST using a -detailed-text-explainer with output going to *test-dribble*" - (explain (make-instance 'detailed-text-explainer) result-list *test-dribble*)) +detailed-text-explainer with output going to *test-dribble*. +Return a boolean indicating whether no tests failed." + (explain (make-instance 'detailed-text-explainer) result-list *test-dribble*) + (notany #'test-failure-p result-list)) (defun debug! (&optional (test-spec *suite*)) "Calls (run! test-spec) but enters the debugger if any kind of error happens." diff --git a/t/tests.lisp b/t/tests.lisp index 6bef836..804b765 100644 --- a/t/tests.lisp +++ b/t/tests.lisp @@ -254,3 +254,11 @@ (for-all (((a b) (dummy-mv-generator))) (is (= 1 a)) (is (= 1 b)))) + +(def-test return-values () + "Return values indicate test failures." + (is-true (with-*test-dribble* nil (explain! (run 'is1)))) + (is-true (with-*test-dribble* nil (run! 'is1))) + + (is-false (with-*test-dribble* nil (explain! (run 'is2)))) + (is-false (with-*test-dribble* nil (run! 'is2))))