From c91ff8298e9007102a71242c88c005a334f6fbfb Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sat, 12 Dec 2015 08:51:40 -0800
Subject: [PATCH] Update lisp-unit.

---
 .../internal-test/example-tests.lisp          |  4 +++
 src/contrib/lisp-unit/lisp-unit.lisp          | 33 ++++++++++++-------
 src/general-info/release-21b.txt              |  1 +
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/src/contrib/lisp-unit/internal-test/example-tests.lisp b/src/contrib/lisp-unit/internal-test/example-tests.lisp
index 6312be077..8aaf9a6e3 100644
--- a/src/contrib/lisp-unit/internal-test/example-tests.lisp
+++ b/src/contrib/lisp-unit/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/src/contrib/lisp-unit/lisp-unit.lisp b/src/contrib/lisp-unit/lisp-unit.lisp
index efaae1a49..ae265fd05 100644
--- a/src/contrib/lisp-unit/lisp-unit.lisp
+++ b/src/contrib/lisp-unit/lisp-unit.lisp
@@ -126,8 +126,9 @@ functions or even macros does not require reloading any tests.
   "If not NIL, enter the debugger when an error is encountered in an
 assertion.")
 
-(defparameter *signal-results* nil
-  "Signal the result if non NIL.")
+(defun use-debugger (&optional (flag t))
+  "Use the debugger when testing, or not."
+  (setq *use-debugger* flag))
 
 (defun use-debugger-p (condition)
   "Debug or ignore errors."
@@ -136,9 +137,8 @@ assertion.")
     (y-or-n-p "~A -- debug?" condition))
    (*use-debugger*)))
 
-(defun use-debugger (&optional (flag t))
-  "Use the debugger when testing, or not."
-  (setq *use-debugger* flag))
+(defparameter *signal-results* nil
+  "Signal the result if non NIL.")
 
 (defun signal-results (&optional (flag t))
   "Signal the results for extensibility."
@@ -238,7 +238,7 @@ assertion.")
      ((and (stringp item) (not doc) (rest body))
       (if tag
           (values doc tag (rest body))
-          (parse-body (rest body) doc tag)))
+          (parse-body (rest body) item tag)))
      (t (values doc tag body)))))
 
 (defun test-name-error-report (test-name-error stream)
@@ -260,20 +260,31 @@ 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 (string ,qname))))
+              (doc (or ,doc (symbol-name ,qname)))
+              (package (test-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))))
 
diff --git a/src/general-info/release-21b.txt b/src/general-info/release-21b.txt
index 3355fc4dc..32842e5a8 100644
--- a/src/general-info/release-21b.txt
+++ b/src/general-info/release-21b.txt
@@ -43,6 +43,7 @@ New in this release:
     * Unix support on Linux has been unified with all other OSes.
       Thus, src/code/unix-glibc2.lisp is no longer used.
     * Micro-optimize modular shifts on x86.
+    * Update lisp-unit to commit e6c259f.
 
   * ANSI compliance fixes:
 
-- 
GitLab