summaryrefslogtreecommitdiff
path: root/tests
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
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')
-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 @@
33 #:use-module (gnu packages) 33 #:use-module (gnu packages)
34 #:use-module (gnu packages base) 34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bootstrap) 35 #:use-module (gnu packages bootstrap)
36 #:use-module ((guix diagnostics) #:select (guix-warning-port)) 36 #:use-module ((guix diagnostics) #:select (error-location
37 error-location?
38 guix-warning-port
39 source-properties->location))
37 #:use-module (srfi srfi-1) 40 #:use-module (srfi srfi-1)
38 #:use-module (srfi srfi-34) 41 #:use-module (srfi srfi-34)
39 #:use-module (srfi srfi-64) 42 #:use-module (srfi srfi-64)
@@ -1307,6 +1310,18 @@ importing.* \\(guix config\\) from the host"
1307 (run-with-store %store 1310 (run-with-store %store
1308 (lower-gexp #~(#\+))))) 1311 (lower-gexp #~(#\+)))))
1309 1312
1313(let* ((g #~#$*unspecified*)
1314 (loc (current-source-location)) ;keep this alignment!
1315 (g-loc (source-properties->location
1316 `((line . ,(- (assq-ref loc 'line) 1))
1317 ,@(alist-delete 'line loc)))))
1318 (test-equal "lower-gexp, invalid input location"
1319 g-loc
1320 (guard (c ((and (gexp-input-error? c) (error-location? c))
1321 (error-location c)))
1322 (run-with-store %store
1323 (lower-gexp g)))))
1324
1310(test-assertm "gexp->derivation #:references-graphs" 1325(test-assertm "gexp->derivation #:references-graphs"
1311 (mlet* %store-monad 1326 (mlet* %store-monad
1312 ((one (text-file "one" (random-text))) 1327 ((one (text-file "one" (random-text)))