[Pkg-gnupg-commit] [gnupg2] 151/180: gpgscm: Display location when assertions fail.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 3949cbd1128585c9b810713aeffaa1455fb5aed9
Author: Justus Winter <justus at g10code.com>
Date:   Mon Dec 19 15:28:07 2016 +0100

    gpgscm: Display location when assertions fail.
    
    * tests/gpgscm/lib.scm (assert): Use location information if
    available.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 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 fabbef8..6959aa4 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) '())

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list