[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-106-g1e428

From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-106-g1e42832
Date: Sat, 23 Nov 2013 03:54:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  1e42832af07ea6ac68ecbe4f6a3376ff509a2a51 (commit)
      from  8904b7a9362ede0de324e55701d8ea1d018f8738 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1e42832af07ea6ac68ecbe4f6a3376ff509a2a51
Author: Chris K. Jester-Young <address@hidden>
Date:   Sun Oct 27 17:31:38 2013 -0400

    Convert test-suite/tests/exceptions.test to use hygienic macros.
    * test-suite/tests/exceptions.test (push): New syntax parameter.
      (throw-test): Convert to a syntax-rules macro, using syntax parameters
      to support the otherwise-unhygienic use of "push".


Summary of changes:
 test-suite/tests/exceptions.test |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/test-suite/tests/exceptions.test b/test-suite/tests/exceptions.test
index bcaa282..a839b68 100644
--- a/test-suite/tests/exceptions.test
+++ b/test-suite/tests/exceptions.test
@@ -18,18 +18,20 @@
 (use-modules (test-suite lib))
-(define-macro (throw-test title result . exprs)
-  `(pass-if ,title
-     (equal? ,result
-            (letrec ((stack '())
-                     (push (lambda (val)
-                             (set! stack (cons val stack)))))
-              (begin ,@exprs)
-              ;;(display ,title)
-              ;;(display ": ")
-              ;;(write (reverse stack))
-              ;;(newline)
-              (reverse stack)))))
+(define-syntax-parameter push
+  (lambda (stx)
+    (syntax-violation 'push "push used outside of throw-test" stx)))
+(define-syntax-rule (throw-test title result expr ...)
+  (pass-if title
+    (equal? result
+            (let ((stack '()))
+              (syntax-parameterize ((push (syntax-rules ()
+                                            ((push val)
+                                             (set! stack (cons val stack))))))
+                expr ...
+                ;;(format #t "~a: ~s~%" title (reverse stack))
+                (reverse stack))))))
 (with-test-prefix "throw/catch"

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]