[PATCH consfigurator v3 4/8] provide macro with-reset-data-sources

David Bremner david at tethera.net
Sun Mar 13 14:40:07 GMT 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    | 8 ++++++++
 src/package.lisp | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/data.lisp b/src/data.lisp
index 0b55001..4b4b9e8 100644
--- a/src/data.lisp
+++ b/src/data.lisp
@@ -146,6 +146,14 @@ This function is typically called at the REPL."
         *data-sources* nil
         *data-source-registrations* nil))
 
+(defmacro with-reset-data-sources (&rest 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 cc6f42b..eaa1aef 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -324,6 +324,7 @@
            #:make-passphrase
            #:get-data-protected-string
            #:*data-source-gnupghome*
+           #:with-reset-data-sources
 
            ;; image.lisp
            #:eval-in-grandchild
-- 
2.35.1




More information about the sgo-software-discuss mailing list