diff options
author | Justus Winter <[email protected]> | 2016-12-19 14:28:07 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-12-19 14:42:35 +0000 |
commit | 3949cbd1128585c9b810713aeffaa1455fb5aed9 (patch) | |
tree | 7e42891183c1fd663e035dd7e3d3410fdc9500dd | |
parent | gpgscm: Make exception handling more robust. (diff) | |
download | gnupg-3949cbd1128585c9b810713aeffaa1455fb5aed9.tar.gz gnupg-3949cbd1128585c9b810713aeffaa1455fb5aed9.zip |
gpgscm: Display location when assertions fail.
* tests/gpgscm/lib.scm (assert): Use location information if
available.
Signed-off-by: Justus Winter <[email protected]>
-rw-r--r-- | tests/gpgscm/lib.scm | 15 |
1 files 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 <http://www.gnu.org/licenses/>. (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) '()) |