summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-16 15:03:52 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-10 22:46:15 +0200
commite1c153e0ab116a174ea0ed88b76f222927048c5f (patch)
tree20f3bad7cf98e82d8f6b4652279d4278e9001c0e /tests/gexp.scm
parentb893f1aec35b879169f80bc9461fac21907fbaf4 (diff)
downloadguix-e1c153e0ab116a174ea0ed88b76f222927048c5f.tar.gz
gexp: Add 'scheme-file'.
* guix/gexp.scm (<scheme-file>): New record type.
  (scheme-file, scheme-file-compiler): New procedures.
* tests/gexp.scm ("scheme-file"): New test.
* doc/guix.texi (G-Expressions): Document 'scheme-file'.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 77439cf6e9..4860a8e79c 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -636,6 +636,19 @@
           (return (and (zero? (close-pipe pipe))
                        (= n (string->number str)))))))))
 
+(test-assertm "scheme-file"
+  (let* ((text   (plain-file "foo" "Hello, world!"))
+         (scheme (scheme-file "bar" #~(list "foo" #$text))))
+    (mlet* %store-monad ((drv  (lower-object scheme))
+                         (text (lower-object text))
+                         (out -> (derivation->output-path drv)))
+      (mbegin %store-monad
+        (built-derivations (list drv))
+        (mlet %store-monad ((refs ((store-lift references) out)))
+          (return (and (equal? refs (list text))
+                       (equal? `(list "foo" ,text)
+                               (call-with-input-file out read)))))))))
+
 (test-assert "text-file*"
   (let ((references (store-lift references)))
     (run-with-store %store