summaryrefslogtreecommitdiff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorYarl Baudig <yarl-baudig@mailoo.org>2026-03-28 12:19:54 +0100
committerLudovic Courtès <ludo@gnu.org>2026-03-29 22:11:38 +0200
commit785f4c6ed9b3e7a8ff31fe7a719848b7b14ad5dc (patch)
tree4f036a35068df45320b8e5b475a1b7beaa51fc17 /tests/gexp.scm
parent1b08655ef8a7e99c5031b456dba1b6f86b9c5444 (diff)
gexp: improve &gexp-input-error with &error-location.
* guix/gexp.scm (gexp->sexp): raise &error-location along &gexp-input-error. * guix/ui.scm (call-with-error-handling): use this. * tests/gexp.scm (lower-gexp, invalid input location): New test. Change-Id: Iee761e5f99502065182d9e6fc8d21399e99ec6c3 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Merges: #7538
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index bba8c141f63..1646d48a425 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -33,7 +33,10 @@
#:use-module (gnu packages)
#:use-module (gnu packages base)
#:use-module (gnu packages bootstrap)
- #:use-module ((guix diagnostics) #:select (guix-warning-port))
+ #:use-module ((guix diagnostics) #:select (error-location
+ error-location?
+ guix-warning-port
+ source-properties->location))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-64)
@@ -1307,6 +1310,18 @@ importing.* \\(guix config\\) from the host"
(run-with-store %store
(lower-gexp #~(#\+)))))
+(let* ((g #~#$*unspecified*)
+ (loc (current-source-location)) ;keep this alignment!
+ (g-loc (source-properties->location
+ `((line . ,(- (assq-ref loc 'line) 1))
+ ,@(alist-delete 'line loc)))))
+ (test-equal "lower-gexp, invalid input location"
+ g-loc
+ (guard (c ((and (gexp-input-error? c) (error-location? c))
+ (error-location c)))
+ (run-with-store %store
+ (lower-gexp g)))))
+
(test-assertm "gexp->derivation #:references-graphs"
(mlet* %store-monad
((one (text-file "one" (random-text)))