diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-04-11 00:52:40 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-04-11 01:03:47 +0200 |
commit | 4fbd1a2b7f0db819e14d7cc862445d9ab3d0d80f (patch) | |
tree | 17a949d66577a8d9e53d731808906ce0d997c2a6 /tests/gexp.scm | |
parent | a1639ae9de39d5ce47e6ddfd87e792db52b44bd6 (diff) | |
download | guix-4fbd1a2b7f0db819e14d7cc862445d9ab3d0d80f.tar.gz |
gexp: 'scheme-file' can splice expressions.
* guix/gexp.scm (<scheme-file>)[splice?]: New field. (scheme-file): Add #:splice? and pass it to '%scheme-file'. (scheme-file-compiler): Pass SPLICE? to 'gexp->file'. (gexp->file): Add #:splice? and honor it. * tests/gexp.scm ("gexp->file + #:splice?"): New test. ("gexp->derivation & with-imported-module & computed module"): Use #:splice? #t.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r-- | tests/gexp.scm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 2f8940e2c6..3c8b4624da 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -419,6 +419,24 @@ (call-with-input-file out read)) (equal? (list guile) refs))))) +(test-assertm "gexp->file + #:splice?" + (mlet* %store-monad ((exp -> (list + #~(define foo 'bar) + #~(define guile #$%bootstrap-guile))) + (guile (package-file %bootstrap-guile)) + (drv (gexp->file "splice" exp #:splice? #t)) + (out -> (derivation->output-path drv)) + (done (built-derivations (list drv))) + (refs (references* out))) + (pk 'splice out) + (return (and (equal? `((define foo 'bar) + (define guile ,guile) + ,(call-with-input-string "" read)) + (call-with-input-file out + (lambda (port) + (list (read port) (read port) (read port))))) + (equal? (list guile) refs))))) + (test-assertm "gexp->derivation" (mlet* %store-monad ((file (text-file "foo" "Hello, world!")) (exp -> (gexp @@ -700,11 +718,12 @@ (test-assertm "gexp->derivation & with-imported-module & computed module" (mlet* %store-monad - ((module -> (scheme-file "x" #~(begin + ((module -> (scheme-file "x" #~(;; splice! (define-module (foo bar) #:export (the-answer)) - (define the-answer 42)))) + (define the-answer 42)) + #:splice? #t)) (build -> (with-imported-modules `(((foo bar) => ,module) (guix build utils)) #~(begin |