diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-03-23 18:35:32 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-03-23 18:41:07 +0100 |
commit | 427ec19e8887b8036690734564a86496000e12a6 (patch) | |
tree | ce9262cc6a68c9e1a3f23cc3024b32fe9a8d585f /tests | |
parent | 1ae16033f34cebe802023922436883867010850f (diff) | |
download | guix-427ec19e8887b8036690734564a86496000e12a6.tar.gz |
gexp: 'program-file' has a new #:module-path parameter.
* guix/gexp.scm (<program-file>): Add 'path' field. (program-file): Add #:module-path parameter and honor it. (program-file-compiler): Honor the 'path' field. * tests/gexp.scm ("program-file #:module-path"): New test. * doc/guix.texi (G-Expressions): Update.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gexp.scm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index a0198b13a0..2f8940e2c6 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -902,6 +902,33 @@ (return (and (zero? (close-pipe pipe)) (= n (string->number str))))))))) +(test-assertm "program-file #:module-path" + (call-with-temporary-directory + (lambda (directory) + (define text (random-text)) + + (call-with-output-file (string-append directory "/stupid-module.scm") + (lambda (port) + (write `(begin (define-module (stupid-module)) + (define-public %stupid-thing ,text)) + port))) + + (let* ((exp (with-imported-modules '((stupid-module)) + (gexp (begin + (use-modules (stupid-module)) + (display %stupid-thing))))) + (file (program-file "program" exp + #:guile %bootstrap-guile + #:module-path (list directory)))) + (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)) + (string=? text str)))))))))) + (test-assertm "scheme-file" (let* ((text (plain-file "foo" "Hello, world!")) (scheme (scheme-file "bar" #~(list "foo" #$text)))) |