From 225a1920ce3b74164744d796644fbf66b8308b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Endsj=C3=B8?= Date: Mon, 8 Apr 2024 13:30:10 +0200 Subject: [PATCH] Set `*package*` for functions and macros And no longer for `test-package`. --- src/doctest.lisp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/doctest.lisp b/src/doctest.lisp index ff714f2..72543f2 100644 --- a/src/doctest.lisp +++ b/src/doctest.lisp @@ -288,7 +288,8 @@ (multiple-value-bind (documentation function-name) (extract-function-documentation-and-name function) (if documentation (multiple-value-bind (tests-failed tests-passed) - (test-docstring documentation :output output :test test) + (let ((*package* (symbol-package function))) + (test-docstring documentation :output output :test test)) (print-results function-name 'function output tests-failed tests-passed)) (values 0 0)))) @@ -301,7 +302,8 @@ (if (documentation macro 'function) (let ((macro-name (third (multiple-value-list (function-lambda-expression (macro-function macro)))))) (multiple-value-bind (tests-failed tests-passed) - (test-docstring (documentation macro 'function) :output output :test test) + (let ((*package* (symbol-package macro))) + (test-docstring (documentation macro 'function) :output output :test test)) (print-results macro-name 'macro output tests-failed tests-passed))) (values 0 0))) @@ -320,9 +322,9 @@ (defun test-package (package &key (output t) (test #'equalp)) (let ((total-failed 0) (total-passed 0)) - (let ((*package* (find-package package))) + (let ((package (find-package package))) (do-symbols (symbol (find-package package)) - (when (eq *package* (symbol-package symbol)) + (when (eq package (symbol-package symbol)) (multiple-value-bind (tests-failed tests-passed) (test symbol :output output :test test) (incf total-failed tests-failed) (incf total-passed tests-passed)))))