summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-09-08 22:56:40 +0200
committerLudovic Courtès <ludo@gnu.org>2018-09-08 23:02:01 +0200
commit5dec93bb8ba89605bce2f9a5ee9c4dbadeee3b58 (patch)
tree28b7f873e8d7dd919b2110ab0bc1898aeeaaf300 /tests/gexp.scm
parente80c725db7d11618dec7c3f92845f71b0a9715b0 (diff)
downloadguix-5dec93bb8ba89605bce2f9a5ee9c4dbadeee3b58.tar.gz
gexp: 'file-union' accepts directory names.
* guix/gexp.scm (file-union): Import (guix build utils).  Make the
parent directories of TARGET.
* tests/gexp.scm ("file-union"): New test.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index b22e635805..5d049cd5fc 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -1093,6 +1093,24 @@
                                (call-with-input-file out get-string-all))
                      (equal? refs (list guile))))))))
 
+(test-assertm "file-union"
+  (mlet* %store-monad ((union -> (file-union "union"
+                                             `(("a" ,(plain-file "a" "1"))
+                                               ("b/c/d" ,(plain-file "d" "2"))
+                                               ("e" ,(plain-file "e" "3")))))
+                       (drv      (lower-object union))
+                       (out ->   (derivation->output-path drv)))
+    (define (contents=? file str)
+      (string=? (call-with-input-file (string-append out "/" file)
+                  get-string-all)
+                str))
+
+    (mbegin %store-monad
+      (built-derivations (list drv))
+      (return (and (contents=? "a" "1")
+                   (contents=? "b/c/d" "2")
+                   (contents=? "e" "3"))))))
+
 (test-assert "gexp->derivation vs. %current-target-system"
   (let ((mval (gexp->derivation "foo"
                                 #~(begin