aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArun Isaac2021-10-04 16:55:21 +0530
committerArun Isaac2021-10-04 16:55:21 +0530
commit8cb1b1972fb00245a8a24d75e51b1cd8d474d1de (patch)
tree26669c6ede0166e9c249c5d694ef58b286a7843b /tests
parentffb909bf27158e10a032dc4df0d0c54bba37889b (diff)
downloadccwl-8cb1b1972fb00245a8a24d75e51b1cd8d474d1de.tar.gz
ccwl-8cb1b1972fb00245a8a24d75e51b1cd8d474d1de.tar.lz
ccwl-8cb1b1972fb00245a8a24d75e51b1cd8d474d1de.zip
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/utils.scm15
1 files changed, 15 insertions, 0 deletions
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)