From: Thomas M. Hermann Date: Sat, 21 Dec 2013 04:47:56 +0000 (-0600) Subject: Store the test in the appropriate package. X-Git-Tag: Version-1.0.0~1 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/e6c259f333f038abd32a31c4138775045e9d640d Store the test in the appropriate package. --- diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 8d941fe..ae265fd 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -260,13 +260,23 @@ assertion.") name (error 'test-name-error :datum name))) +(defun test-package (name) + "Return the package for storing the test." + (multiple-value-bind (symbol status) + (find-symbol (symbol-name name)) + (declare (ignore symbol)) + (ecase status + ((:internal :external nil) + (symbol-package name)) + (:inherited *package*)))) + (defmacro define-test (name &body body) "Store the test in the test database." (let ((qname (gensym "NAME-"))) (multiple-value-bind (doc tag code) (parse-body body) `(let* ((,qname (valid-test-name ',name)) (doc (or ,doc (symbol-name ,qname))) - (package (symbol-package ,qname))) + (package (test-package ,qname))) (setf ;; Unit test (gethash ,qname (package-table package t))