From 8cb1b1972fb00245a8a24d75e51b1cd8d474d1de Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 4 Oct 2021 16:55:21 +0530 Subject: ccwl: Support #:allow-other-keys in lambda** and syntax-lambda**. * ccwl/utils.scm (lambda**): Support #:allow-other-keys. Update docstring. (syntax-lambda**): Update docstring. * tests/utils.scm ("Allow other keys in lambda**", "Allow other keys in syntax-lambda**"): New tests. --- tests/utils.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/utils.scm b/tests/utils.scm index a123719..3c8fac4 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -85,6 +85,12 @@ '(lambda** (#:key foo #:foo bar) foo))) +(test-equal "Allow other keys in lambda**" + 1 + ((lambda** (#:key foo #:allow-other-keys) + foo) + #:foo 1 #:bar 2)) + (test-assert "syntax-lambda**" (equal? (list #'1 #'2 #'123 (list #'1 #'2 #'3)) ((syntax-lambda** (a b #:key foo #:key* bar) @@ -97,6 +103,15 @@ (list foo aal vale pal naal irandu sol)) #'1 #'2 #'#:vale #'123 #'#:naal #'321 #'456))) +;; We cannot use test-equal to compare syntax objects, since +;; test-equal does not preserve the lexical contexts of the test +;; expressions. +(test-assert "Allow other keys in syntax-lambda**" + (equal? #'1 + ((syntax-lambda** (#:key foo #:allow-other-keys) + foo) + #'#:foo #'1 #'#:bar #'2))) + (test-equal "filter-mapi" '(1 3 5 7 9) (filter-mapi (lambda (item index) -- cgit v1.2.3