mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 13:10:33 +02:00
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
This commit is contained in:
committed by
Ludovic Courtès
parent
1b08655ef8
commit
785f4c6ed9
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user