From: Thomas M. Hermann Date: Sat, 24 Aug 2013 13:35:29 +0000 (-0500) Subject: Store the test based on the SYMBOL-PACKAGE of the test name, not *PACKAGE*. X-Git-Tag: Version-1.0.0~3 X-Git-Url: https://repo.or.cz/w/lisp-unit.git/commitdiff_plain/04d3edf589a0c37e71617a10eccd4103f9bf1414 Store the test based on the SYMBOL-PACKAGE of the test name, not *PACKAGE*. --- diff --git a/internal-test/example-tests.lisp b/internal-test/example-tests.lisp index 6312be0..8aaf9a6 100644 --- a/internal-test/example-tests.lisp +++ b/internal-test/example-tests.lisp @@ -57,6 +57,10 @@ (dotimes (i 5) (assert-equal i (my-sqrt (* i i)) i))) +(define-test cl-user::my-sqrt + (dotimes (i 5) + (assert-equal i (my-sqrt (* i i)) i))) + ;;; Macro (defmacro my-macro (arg1 arg2) diff --git a/lisp-unit.lisp b/lisp-unit.lisp index 85c0fa8..fbecfcd 100644 --- a/lisp-unit.lisp +++ b/lisp-unit.lisp @@ -265,15 +265,16 @@ assertion.") (let ((qname (gensym "NAME-"))) (multiple-value-bind (doc tag code) (parse-body body) `(let* ((,qname (valid-test-name ',name)) - (doc (or ,doc (string ,qname)))) + (doc (or ,doc (symbol-name ,qname))) + (package (symbol-package ,qname))) (setf ;; Unit test - (gethash ,qname (package-table *package* t)) + (gethash ,qname (package-table package t)) (make-instance 'unit-test :doc doc :code ',code)) ;; Tags - (loop for tag in ',tag do - (pushnew - ,qname (gethash tag (package-tags *package* t)))) + (loop + for tag in ',tag do + (pushnew ,qname (gethash tag (package-tags package t)))) ;; Return the name of the test ,qname))))