From 7bf2d503c2978e7fd7cc5d4abcdd7beab9c32feb Mon Sep 17 00:00:00 2001 From: Jakub Jankiewicz Date: Thu, 20 Aug 2020 17:53:06 +0200 Subject: [PATCH] add disabled test for syntax-rules identifiers #43 --- tests/syntax.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/syntax.scm b/tests/syntax.scm index 2a799c584..4da9b1bd7 100644 --- a/tests/syntax.scm +++ b/tests/syntax.scm @@ -581,3 +581,28 @@ (t.is (test 1 2 3) '((1 . ...) (2 . ...) (3 . ...))) (t.is (test) '((1 . ...) (2 . ...))))) + + +(test_ "syntax-rules: it should handle identifiers" + (lambda (t) + + (define-syntax for + (syntax-rules (in as) + ((for element in list body ...) + (map (lambda (element) + body ...) + list)) + ((for list as element body ...) + (for element in list body ...)))) + + (t.is (let ((result '())) + (for i in '(0 1 2 3 4) + (set! result (cons i result))) + result) + '(4 3 2 1 0)) + + (t.is (let ((result '())) + (for '(0 1 2 3 4) as i + (set! result (cons i result))) + result) + '(4 3 2 1 0))))