[PATCH consfigurator v4 4/7] provide macro WITH-RESET-DATA-SOURCES

David Bremner david at tethera.net
Thu May 5 12:29:23 BST 2022


As the docstring hints, this will be used in the test suite.

Signed-off-by: David Bremner <david at tethera.net>
---
 src/data.lisp    | 9 +++++++++
 src/package.lisp | 1 +
 2 files changed, 10 insertions(+)

diff --git a/src/data.lisp b/src/data.lisp
index 9a219c3..d5d9d4c 100644
--- a/src/data.lisp
+++ b/src/data.lisp
@@ -143,6 +143,15 @@ This function is typically called at the REPL."
         *data-sources* nil
         *data-source-registrations* nil))
 
+(defmacro with-reset-data-sources (&body body)
+  "Run BODY with initially empty data sources and string data.
+
+This macro is typically used for testing or debugging."
+  `(let ((*string-data* (make-hash-table))
+         *data-sources*
+         *data-source-registrations*)
+     , at body))
+
 (defun get-data-string (iden1 iden2)
   "Return the content of an item of prerequisite data as a string.
 
diff --git a/src/package.lisp b/src/package.lisp
index 3819017..1bbf7b6 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -325,6 +325,7 @@
            #:unwrap-passphrase
            #:get-data-protected-string
            #:*data-source-gnupghome*
+           #:with-reset-data-sources
 
            ;; image.lisp
            #:eval-in-grandchild
-- 
2.35.2




More information about the sgo-software-discuss mailing list