summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-05 13:30:29 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-09 23:05:26 +0900
commit18ed22536d08121c3d8f27a001d4d877c08340b2 (patch)
treee96cdded70dd2d08b69e60c5f2246348e7dcc0d4 /tests
parentbc2e923c19e79877a2ce3f360d3fadfdcb93515b (diff)
ui: Allow evaluating multi-expressions strings with read/eval.
This can be useful when evaluating a scheme-file store output for example, which has multiple top level expressions. * guix/ui.scm (read/eval): Also accept a port object as argument. Read and evaluate all expressions from input port or string. Change-Id: I0213706fa4824c3a8ffe5d93f44f263048cb62c2
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-build.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 343e6662a3..79306c8998 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -2,6 +2,7 @@
# Copyright © 2012-2014, 2016-2025 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
# Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+# Copyright © 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
#
# This file is part of GNU Guix.
#
@@ -420,6 +421,22 @@ then
guix build -m <(echo '(specifications->manifest (list "guile"))') -n
fi
+# Build a scheme->file object via multiple expressions, and validate it
+# produces the correct result when evaluated.
+scheme_file=$(guix build -e \
+ "(use-modules (guix gexp)) \
+ (scheme-file \"mathematics\" \
+ '(begin \
+ (define add +) \
+ (define multiply *) \
+ (add 5 (multiply 2 10)))
+ #:guile (@@ (gnu packages bootstrap) %bootstrap-guile))")
+guile -c \
+ "(begin \
+ (use-modules (guix ui) (rnrs base) (srfi srfi-26)) \
+ (assert (= 25 (call-with-input-file \"$scheme_file\" \
+ (cut read/eval <>)))))"
+
# Using 'GUIX_BUILD_OPTIONS'.
GUIX_BUILD_OPTIONS="--dry-run --no-grafts"
export GUIX_BUILD_OPTIONS