summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-07 22:37:14 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-10 22:46:14 +0200
commit919370291f4f9cc93878eea7db11013949ee8473 (patch)
treecd86c3cf59adc2d07e398ad6779a62de0c09d7f9 /tests
parenta72ccbc25125d0d14cabdc1b0f824f27bb64478b (diff)
gexp: Add 'computed-file'.
* guix/gexp.scm (<computed-file>): New record type. (computed-file, computed-file-compiler): New procedures. * tests/gexp.scm ("lower-object, computed-file"): New test. * doc/guix.texi (G-Expressions): Document 'computed-file'.
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 492f3d6d89..ccbbbae7da 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -661,6 +661,25 @@
(return (and (derivation? drv1) (derivation? drv2)
(store-path? item)))))
+(test-assertm "lower-object, computed-file"
+ (let* ((text (plain-file "foo" "Hello!"))
+ (exp #~(begin
+ (mkdir #$output)
+ (symlink #$%bootstrap-guile
+ (string-append #$output "/guile"))
+ (symlink #$text (string-append #$output "/text"))))
+ (computed (computed-file "computed" exp)))
+ (mlet* %store-monad ((text (lower-object text))
+ (guile-drv (lower-object %bootstrap-guile))
+ (comp-drv (lower-object computed))
+ (comp -> (derivation->output-path comp-drv)))
+ (mbegin %store-monad
+ (built-derivations (list comp-drv))
+ (return (and (string=? (readlink (string-append comp "/guile"))
+ (derivation->output-path guile-drv))
+ (string=? (readlink (string-append comp "/text"))
+ text)))))))
+
(test-assert "printer"
(string-match "^#<gexp \\(string-append .*#<package coreutils.*\
\"/bin/uname\"\\) [[:xdigit:]]+>$"