summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-08 07:16:00 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-08 07:16:00 -0800
commit1e4eadfd30f675f80e17e84682dfc88da6be9681 (patch)
treea1bc89f27d7d4c748f4189f974a95a59f1f933ce /tests
parenta621bb39d04e1f77fc45c24a3ac3fc08291533fa (diff)
downloadtxr-1e4eadfd30f675f80e17e84682dfc88da6be9681.tar.gz
txr-1e4eadfd30f675f80e17e84682dfc88da6be9681.tar.bz2
txr-1e4eadfd30f675f80e17e84682dfc88da6be9681.zip
each-match macro family: missing anon block.
* txr.1: Adding the missing requirement that each-match and the other macros in that family must have an implicit anonymous block around the body forms. This is a requirements bug, effectively: the programmer expects these operators to be consistent with the each operator, as part of the same family. * match.tl (each-match-expander): Implement the requirement. Since we are using mapping functions, we must use temporary variables: the evaluation of the expressions which produce the sequence argument values to the mapping functions must be outside of the anonymous block. The block must surround only the function call. * tests/011/patmatch.tl: Add small test case covering this.
Diffstat (limited to 'tests')
-rw-r--r--tests/011/patmatch.tl3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index da2f8de4..fbdd3da0 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -470,6 +470,9 @@
(list x y))
((1 2) (1 4) (3 2) (3 4) (5 2) (5 4)))
+(test
+ (each-match (@a '(1 2 3)) (return 42)) 42)
+
(mtest
(when-match ^(,a ,b) '(1 2) (list a b)) (1 2)
(when-match ^(,(oddp @a) ,(evenp @b)) '(1 2) (list a b)) (1 2)