summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-11-27 22:10:38 +0100
committerLudovic Courtès <ludo@gnu.org>2021-11-27 23:06:17 +0100
commit6b30eb189e48e290136d6a838729cf2eb07ee82f (patch)
tree7706a194d238e855743af5a8a49acc4ca92f7046 /tests/gexp.scm
parent61ad9bc2adc189f41128874649b115cfaadec48d (diff)
downloadguix-6b30eb189e48e290136d6a838729cf2eb07ee82f.tar.gz
gexp: 'file-append' correctly handles bases without an expander.
This fixes this use case:

  (file-append (let-system ...) ...)

* guix/gexp.scm (file-append-compiler): When BASE lacks an expander,
delegate to LOWERED.
* tests/gexp.scm ("let-system in file-append"): New test.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index b720671735..ad8e1d57b8 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -441,6 +441,17 @@
                   '(system-binding)))
             (x x)))))
 
+(test-assert "let-system in file-append"
+  (let ((mixed (file-append (let-system (system target)
+                              (if (not target) grep sed))
+                            "/bin"))
+        (grep  (file-append grep "/bin"))
+        (sed   (file-append sed "/bin")))
+    (and (equal? (gexp->sexp* #~(list #$mixed))
+                 (gexp->sexp* #~(list #$grep)))
+         (equal? (gexp->sexp* #~(list #$mixed) "powerpc64le-linux-gnu")
+                 (gexp->sexp* #~(list #$sed) "powerpc64le-linux-gnu")))))
+
 (test-assert "ungexp + ungexp-native"
   (let* ((exp    (gexp (list (ungexp-native %bootstrap-guile)
                              (ungexp coreutils)