summaryrefslogtreecommitdiffstats
path: root/tests/010
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-01-18 07:50:17 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-01-18 07:50:17 -0800
commit3bcad308dba9cbe1ee6e66fc405e479c29992567 (patch)
tree8b150d021e727e980b6b38e634f23b5efd74a355 /tests/010
parentfbe8228a05d169c539cd36218b466e5d298923ba (diff)
downloadtxr-3bcad308dba9cbe1ee6e66fc405e479c29992567.tar.gz
txr-3bcad308dba9cbe1ee6e66fc405e479c29992567.tar.bz2
txr-3bcad308dba9cbe1ee6e66fc405e479c29992567.zip
quasiquote: make new @,expr work in dot position.
Bugfix: the newly introduced @.expr fails in the dotted position because ^(a . @,expr) turns into (list 'a 'let ...). * eval.c (is_meta_unquote): New static function. (expand_qquote_rec): Replace existing shape test with is_meta_unquote. We must also use this test in one more place: whenever the cdr of a list has the meta unquote shape, we must treat the result similarly to a dotted atom, by converting to append format. * tests/010/qquote.tl: Test cases to cover this.
Diffstat (limited to 'tests/010')
-rw-r--r--tests/010/qquote.tl12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/010/qquote.tl b/tests/010/qquote.tl
index e6daad3a..26d5417b 100644
--- a/tests/010/qquote.tl
+++ b/tests/010/qquote.tl
@@ -9,15 +9,27 @@
(tree-bind (x y (op arg)) ^(a b @,sym)
(assert (eq op 'sys:var))
(assert (eq arg sym)))
+ (tree-bind (x y . (op arg)) ^(a b . @,sym)
+ (assert (eq op 'sys:var))
+ (assert (eq arg sym)))
(tree-bind (x y (op arg)) ^(a b @,atom)
(assert (eq op 'sys:var))
(assert (eq arg atom)))
+ (tree-bind (x y . (op arg)) ^(a b . @,atom)
+ (assert (eq op 'sys:var))
+ (assert (eq arg atom)))
(tree-bind (x y (op arg)) ^(a b @,cons)
(assert (eq op 'sys:expr))
(assert (eq arg cons)))
+ (tree-bind (x y . (op arg)) ^(a b . @,cons)
+ (assert (eq op 'sys:expr))
+ (assert (eq arg cons)))
(tree-bind (x y (op arg)) ^(a b @,dwim)
(assert (eq op 'sys:expr))
(assert (eq arg dwim)))
+ (tree-bind (x y . (op arg)) ^(a b . @,dwim)
+ (assert (eq op 'sys:expr))
+ (assert (eq arg dwim)))
(tree-bind (x y (op arg . tail)) ^(a b (sys:expr ,sym . foo))
(assert (eq op 'sys:expr))
(assert (eq arg sym))