summaryrefslogtreecommitdiffstats
path: root/tests/011
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-08 07:23:21 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-08 07:23:21 -0800
commit5ae2911705d5f907b9355d939c2c72d5c244f2cb (patch)
treea4293f1fff435742ed0c2f03500832d8db5881e4 /tests/011
parent8db7c191d73cd727910f9d656881db9248dfdfad (diff)
downloadtxr-5ae2911705d5f907b9355d939c2c72d5c244f2cb.tar.gz
txr-5ae2911705d5f907b9355d939c2c72d5c244f2cb.tar.bz2
txr-5ae2911705d5f907b9355d939c2c72d5c244f2cb.zip
matcher: add @(or) test involving existing variables.
* tests/011/patmatch.tl: New test case showing that existing variables that don't match in an @(or) retain their values; they do not become nil, unlike freshly bound variables in non-matching or-clauses.
Diffstat (limited to 'tests/011')
-rw-r--r--tests/011/patmatch.tl5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index 36e30fb5..abad6b44 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -77,6 +77,11 @@
(test (when-match @(all @(or (@x @y) @z)) '((1 2) (3 4)) (list x y z))
((1 3) (2 4) (nil nil)))
+(test (let ((a 1) (b 2) (c 3))
+ (if-match @(or @a @b @c) 2
+ (list a b c)))
+ (1 2 3))
+
(test (when-match @(or @(all @x)) '(1 2 3) x) (1 2 3))
(test (when-match (foo @(all @x)) '(bar (1 2 . 3)) x) nil)