From 57886a458b1fcc325d3079e712753e524d3e0cc0 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 30 Jan 2013 10:46:36 -0500 Subject: [PATCH] introduce a `*keep-passing-asserts*` flag to toggle keeping details about passing asserts. When non-nil, passing test assertions will be collected as objects and accessible in test-result objects. When nil, only the type of the passing assertion will be collected, saving significant memory. The default is T, which can consume lots of memory for large numbers of asserts (in my case, sbcl heap exhaustion with 95K assertions). refs #8 --- lisp-unit.lisp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index d2a88db..28be235 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -90,6 +90,8 @@ functions or even macros does not require reloading any tests. :print-failures :print-errors :summarize-results) + ;; behavioral parameters + (:export :*keep-passing-asserts*) ;; Utility predicates (:export :logically-equal :set-equal)) @@ -133,6 +135,11 @@ assertion.") "Use the debugger when testing, or not." (setq *use-debugger* flag)) +(defparameter *keep-passing-asserts* T + "when non-nil, passing test assertions will be collected as objects and + accessible in test-result objects. When nil, only the type of the passing + assertion will be collected, saving memory." ) + ;;; Global unit test database (defparameter *test-db* (make-hash-table :test #'eq) @@ -484,7 +491,8 @@ assertion.") :extras (when extras (funcall extras)) :test test))) (if (passed result) - (push result *pass*) + (push (if *keep-passing-asserts* result type) + *pass*) (push result *fail*)) ;; Return the result (passed result))) -- 2.11.4.GIT