summaryrefslogtreecommitdiffstats
path: root/tests/011
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-01 07:57:44 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-01 07:57:44 -0800
commitd6c12a2fe298112844c032c7a5f439c2dfb4ada1 (patch)
tree879f72d49d634b46b6a4b760b2d8c2fa0f7fa226 /tests/011
parent6255d3c7dca09e98d9e31ecc384ba25f92816916 (diff)
downloadtxr-d6c12a2fe298112844c032c7a5f439c2dfb4ada1.tar.gz
txr-d6c12a2fe298112844c032c7a5f439c2dfb4ada1.tar.bz2
txr-d6c12a2fe298112844c032c7a5f439c2dfb4ada1.zip
matcher: bugfix: bad stray code in @[...] matcher.
* share/txr/stdlib/match.tl (compile-dwim-predicate-match): In he one-argument case, there is stray code referencing var-match.test-expr, which blows up. This is hit by exactly the one example in the documentation that was not added as a test case. * tests/011/patmatch.tl: Add test case from doc.
Diffstat (limited to 'tests/011')
-rw-r--r--tests/011/patmatch.tl4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index 7768e89b..347af4eb 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -161,6 +161,10 @@
(test (when-match (rcons @a @b) '(rcons 1 2) (list a b)) (1 2))
(test (let ((h #H(() (a 1) (b 2))))
+ (when-match @[h x] 'a x))
+ a)
+
+(test (let ((h #H(() (a 1) (b 2))))
(when-match @[h x y] 'a (list x y)))
(a 1))