From ef02f47bb21069e4406003961f4442525566c7df Mon Sep 17 00:00:00 2001 From: "Thomas M. Hermann" Date: Sat, 19 Dec 2015 22:45:33 -0600 Subject: [PATCH] Provide the option for ignoring the code check when the test is defined. This is useful when there are a large number of tests that are already defined correctly. --- lisp-unit.lisp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 2b4bb56..288bc66 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -78,7 +78,8 @@ functions or even macros does not require reloading any tests. :test-documentation :remove-tests :run-tests - :use-debugger) + :use-debugger + :check-code) ;; Functions for managing tags (:export :list-tags :tagged-tests @@ -151,6 +152,13 @@ assertion.") "Signal the results for extensibility." (setq *signal-results* flag)) +(defparameter *check-code* nil + "Check the code when the test is defined if not NIL.") + +(defun check-code (&optional (flag t)) + "Check the code when the test is defined." + (setq *check-code* flag)) + ;;; Global unit test database (defparameter *test-db* (make-hash-table :test #'eq) @@ -284,7 +292,7 @@ assertion.") `(let* ((,qname (valid-test-name ',name)) (doc (or ,doc (symbol-name ,qname))) (package (test-package ,qname))) - (lambda () ,@code) + ,(when *check-code* `(lambda () ,@code)) (setf ;; Unit test (gethash ,qname (package-table package t)) -- 2.11.4.GIT