From 04d3edf589a0c37e71617a10eccd4103f9bf1414 Mon Sep 17 00:00:00 2001 From: "Thomas M. Hermann" Date: Sat, 24 Aug 2013 08:35:29 -0500 Subject: [PATCH] Store the test based on the SYMBOL-PACKAGE of the test name, not *PACKAGE*. --- internal-test/example-tests.lisp | 4 ++++ lisp-unit.lisp | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) 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)))) -- 2.11.4.GIT