From: Thomas M. Hermann Date: Fri, 23 Nov 2012 17:04:14 +0000 (-0600) Subject: Reset the global counters whenever run-tests or run-tags is called. X-Git-Tag: 0.9.4~12 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/5cb75bae995ab92dcd6becbd2b8f938d51ace059 Reset the global counters whenever run-tests or run-tags is called. Results are pushed to the global counters whenever assertions are directly evaluated. These counters cannot, should not, be used directly, so it is a good idea to reset them periodically. A good time to do that is when run-tests or run-tags is called. --- diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 143aa23..2819d58 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -103,6 +103,10 @@ functions or even macros does not require reloading any tests. (defparameter *fail* () "The failed assertion results.") +(defun reset-counters () + "Reset the counters to empty lists." + (setf *pass* () *fail* ())) + ;;; Global options (defparameter *print-summary* nil @@ -669,12 +673,14 @@ assertion.") (defun run-tests (test-names &optional (package *package*)) "Run the specified tests in package." + (reset-counters) (if (eq :all test-names) (%run-all-thunks package) (%run-thunks test-names package))) (defun run-tags (tags &optional (package *package*)) "Run the tests associated with the specified tags in package." + (reset-counters) (%run-thunks (tagged-tests tags package) package)) ;;; Print failures