From 5cb75bae995ab92dcd6becbd2b8f938d51ace059 Mon Sep 17 00:00:00 2001 From: "Thomas M. Hermann" Date: Fri, 23 Nov 2012 11:04:14 -0600 Subject: [PATCH] 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. --- lisp-unit.lisp | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- 2.11.4.GIT