From 3949cbd1128585c9b810713aeffaa1455fb5aed9 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 19 Dec 2016 15:28:07 +0100 Subject: [PATCH] gpgscm: Display location when assertions fail. * tests/gpgscm/lib.scm (assert): Use location information if available. Signed-off-by: Justus Winter --- tests/gpgscm/lib.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index fabbef8a4..6959aa4d0 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -18,13 +18,16 @@ ;; along with this program; if not, see . (macro (assert form) - `(if (not ,(cadr form)) - (begin - (display "Assertion failed: ") - (write (quote ,(cadr form))) - (newline) - (exit 1)))) + (let ((tag (get-tag form))) + `(if (not ,(cadr form)) + (throw ,(if (pair? tag) + `(string-append ,(car tag) ":" + ,(number->string (+ 1 (cdr tag))) + ": Assertion failed: ") + "Assertion failed: ") + (quote ,(cadr form)))))) (assert #t) +(assert (not #f)) (define (filter pred lst) (cond ((null? lst) '())