aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-09-20 11:58:32 +0200
committerLudovic Courtès <ludo@gnu.org>2022-09-20 19:24:31 +0200
commit76c58ed59c05fa2ae14281109c9186e47ba810da (patch)
treeb021b38a1dcee12ff0d5b8576d0b8acd480c0cfa /tests
parentd0a1e48944cea22c6aebb22121eb21122a738d78 (diff)
downloadguix-76c58ed59c05fa2ae14281109c9186e47ba810da.tar
guix-76c58ed59c05fa2ae14281109c9186e47ba810da.tar.gz
home: import: Use (guix read-print) to render the config file.
* guix/scripts/home/import.scm (manifest+configuration-files->code): Insert calls to 'comment' and 'vertical-space'. (import-manifest): Use 'pretty-print-with-comments/splice' instead of a loop on 'pretty-print'. * tests/home-import.scm (remove-recursively): New procedure. (eval-test-with-home-environment): Use it.
Diffstat (limited to 'tests')
-rw-r--r--tests/home-import.scm11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/home-import.scm b/tests/home-import.scm
index d62a6de648..04b7b76156 100644
--- a/tests/home-import.scm
+++ b/tests/home-import.scm
@@ -23,6 +23,7 @@
#:use-module (guix build utils)
#:use-module (guix packages)
#:use-module (ice-9 match)
+ #:use-module ((guix read-print) #:select (blank?))
#:use-module ((guix profiles) #:hide (manifest->code))
#:use-module ((guix build syscalls) #:select (mkdtemp!))
#:use-module ((guix scripts package)
@@ -85,13 +86,21 @@ corresponding file."
((file . content) (create-file file content)))
files-alist))
+(define (remove-recursively pred sexp)
+ "Like SRFI-1 'remove', but recurse within SEXP."
+ (let loop ((sexp sexp))
+ (match sexp
+ ((lst ...)
+ (map loop (remove pred lst)))
+ (x x))))
+
(define (eval-test-with-home-environment files-alist manifest matcher)
(create-temporary-home files-alist)
(setenv "HOME" %temporary-home-directory)
(mkdir-p %temporary-home-directory)
(let* ((home-environment (manifest+configuration-files->code
manifest %destination-directory))
- (result (matcher home-environment)))
+ (result (matcher (remove-recursively blank? home-environment))))
(delete-file-recursively %temporary-home-directory)
result))