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 | b852ac097f3dfe4e62c3d27e18a22f1b9f704530 (patch) | |
tree | a42c775c7fc53697a171bf9816690accf14e9d5d | |
parent | gpgscm: Make exception handling more robust. (diff) | |
download | libgpg-error-b852ac097f3dfe4e62c3d27e18a22f1b9f704530.tar.gz libgpg-error-b852ac097f3dfe4e62c3d27e18a22f1b9f704530.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-- | lib.scm | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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) '()) |