aboutsummaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-08 22:44:26 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-10 22:46:14 +0200
commit15a01c72209b2d43239fe7516a22e531b7fcb85f (patch)
treeefa0f72643c6b53a75966957eef524eeae712072 /tests/gexp.scm
parent919370291f4f9cc93878eea7db11013949ee8473 (diff)
downloadguix-15a01c72209b2d43239fe7516a22e531b7fcb85f.tar
guix-15a01c72209b2d43239fe7516a22e531b7fcb85f.tar.gz
gexp: Add 'program-file'.
* guix/gexp.scm (<program-file>): New record type. (program-file, program-file-compiler): New procedures. * tests/gexp.scm ("program-file"): New test. * doc/guix.texi (G-Expressions): Document it.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index ccbbbae7da..0a8ce6544f 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -619,6 +619,23 @@
(return (and (zero? (close-pipe pipe))
(= (expt n 2) (string->number str)))))))
+(test-assertm "program-file"
+ (let* ((n (random (expt 2 50)))
+ (exp (gexp (begin
+ (use-modules (guix build utils))
+ (display (ungexp n)))))
+ (file (program-file "program" exp
+ #:modules '((guix build utils))
+ #:guile %bootstrap-guile)))
+ (mlet* %store-monad ((drv (lower-object file))
+ (out -> (derivation->output-path drv)))
+ (mbegin %store-monad
+ (built-derivations (list drv))
+ (let* ((pipe (open-input-pipe out))
+ (str (get-string-all pipe)))
+ (return (and (zero? (close-pipe pipe))
+ (= n (string->number str)))))))))
+
(test-assert "text-file*"
(let ((references (store-lift references)))
(run-with-store %store