summary refs log tree commit diff
path: root/tests/home-import.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-31 00:02:27 +0200
committerLudovic Courtès <ludo@gnu.org>2021-10-31 00:51:06 +0200
commit6f4ca78761471602e3af37ee1a33de446114039f (patch)
tree93183c29a4e162eec4a63990076afc1da4c21420 /tests/home-import.scm
parent96728c54df365cc48f14a514b63616ff7a6d052b (diff)
downloadguix-6f4ca78761471602e3af37ee1a33de446114039f.tar.gz
home: import: Avoid duplication of 'manifest->code'.
* guix/scripts/home/import.scm (manifest->code): Remove.
(manifest+configuration-files->code): New procedure.
(import-manifest): Use 'manifest+configuration-files->code' instead of
'manifest->code'.
* tests/home-import.scm (eval-test-with-home-environment): Likewise.
(match-home-environment-transformations): New procedure.
("manifest->code: No services, package transformations"): New test.
Diffstat (limited to 'tests/home-import.scm')
-rw-r--r--tests/home-import.scm33
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/home-import.scm b/tests/home-import.scm
index dc413d8516..abd3cec43d 100644
--- a/tests/home-import.scm
+++ b/tests/home-import.scm
@@ -87,10 +87,8 @@ corresponding file."
   (create-temporary-home files-alist)
   (setenv "HOME" %temporary-home-directory)
   (mkdir-p %temporary-home-directory)
-  (let* ((home-environment (manifest->code manifest %destination-directory
-                                           #:entry-package-version
-                                           manifest-entry-version-prefix
-                                           #:home-environment? #t))
+  (let* ((home-environment (manifest+configuration-files->code
+                            manifest %destination-directory))
          (result (matcher home-environment)))
     (delete-file-recursively %temporary-home-directory)
     result))
@@ -108,6 +106,22 @@ corresponding file."
      ('services
       ('list)))))
 
+(define-home-environment-matcher match-home-environment-transformations
+  ('begin
+    ('use-modules
+     ('gnu 'home)
+     ('gnu 'packages)
+     ('gnu 'services)
+     ('guix 'transformations))
+
+    ('define transform ('options->transformation _))
+    ('home-environment
+     ('packages
+      ('list (transform ('specification->package "guile@2.0.9"))
+             ('specification->package "gcc")
+             ('specification->package "glibc@2.19")))
+     ('services ('list)))))
+
 (define-home-environment-matcher match-home-environment-no-services-nor-packages
   ('begin
     ('use-modules
@@ -141,12 +155,23 @@ corresponding file."
                 ('list ('local-file "/tmp/guix-config/.bashrc"
                                     "bashrc"))))))))))
 
+
 (test-assert "manifest->code: No services"
   (eval-test-with-home-environment
    '()
    (make-manifest (list guile-2.0.9 gcc glibc))
    match-home-environment-no-services))
 
+(test-assert "manifest->code: No services, package transformations"
+  (eval-test-with-home-environment
+   '()
+   (make-manifest (list (manifest-entry
+                          (inherit guile-2.0.9)
+                          (properties `((transformations
+                                         . ((foo . "bar"))))))
+                        gcc glibc))
+   match-home-environment-transformations))
+
 (test-assert "manifest->code: No packages nor services"
   (eval-test-with-home-environment
    '()