diff options
author | Ludovic Courtès <ludo@gnu.org> | 2023-11-12 22:47:43 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-12-22 00:31:40 +0100 |
commit | d9190abbd20f15ea5b55abdd51e1376f05055850 (patch) | |
tree | 295c14c1542f402a581df51b7489441ef1d1b2eb /tests | |
parent | 4771960e5d559d2f3911fd24fd648fa5e97bdf39 (diff) | |
download | guix-d9190abbd20f15ea5b55abdd51e1376f05055850.tar.gz guix-d9190abbd20f15ea5b55abdd51e1376f05055850.zip |
gexp: Add compiler for <gexp-input>.
* guix/gexp.scm (gexp-input-compiler): New procedure.
* tests/gexp.scm ("gexp references non-existent output")
("gexp-input, as first-class input"): New tests.
* doc/guix.texi (G-Expressions): Document it.
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I95b58d6e4d77a54364026b4324fbb00125a9402e
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gexp.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 0e3c446576..871e5f7abb 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -393,6 +393,30 @@ (list item)) (null? (lowered-gexp-inputs lexp))))) +(test-equal "gexp references non-existent output" + "no-default-output" + (guard (c ((derivation-missing-output-error? c) + (derivation-name (derivation-error-derivation c)))) + (let* ((obj (computed-file "no-default-output" + #~(mkdir #$output:bar))) + (exp #~(symlink #$obj #$output)) + (drv (run-with-store %store (lower-gexp exp)))) + (pk 'oops! drv #f)))) + +(test-assert "gexp-input, as first-class input" + ;; Insert a <gexp-input> record in a gexp as a way to specify which output + ;; of OBJ should be used. + (let* ((obj (computed-file "foo" #~(mkdir #$output:bar))) + (exp #~(list #$(gexp-input obj "bar"))) + (drv (run-with-store %store (lower-object obj))) + (item (derivation->output-path drv "bar")) + (lexp (run-with-store %store (lower-gexp exp)))) + (and (match (lowered-gexp-inputs lexp) + ((input) + (eq? (derivation-input-derivation input) drv))) + (equal? (lowered-gexp-sexp lexp) + `(list ,item))))) + (test-assertm "with-parameters for %current-system" (mlet* %store-monad ((system -> (match (%current-system) ("aarch64-linux" "x86_64-linux") |