Skip to content

Commit

Permalink
Set *package* for functions and macros
Browse files Browse the repository at this point in the history
And no longer for `test-package`.
  • Loading branch information
simendsjo committed Apr 8, 2024
1 parent b18861d commit 225a192
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/doctest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))))

Expand All @@ -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)))

Expand All @@ -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)))))
Expand Down

0 comments on commit 225a192

Please sign in to comment.