summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-02 06:26:14 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-02 06:26:14 -0800
commit88be89a6449f883b5e5c3b9187cfd63725edd91c (patch)
treebabaa7e1224aff85a49553b26d18198a18141a8d
parent2a3c1884a0b894a2f0c81666b24fee37d230de8e (diff)
downloadtxr-88be89a6449f883b5e5c3b9187cfd63725edd91c.tar.gz
txr-88be89a6449f883b5e5c3b9187cfd63725edd91c.tar.bz2
txr-88be89a6449f883b5e5c3b9187cfd63725edd91c.zip
matcher: new failing backreferencing test case.
* tests/011/patmatch.tl: New test cases that break. The (copy var-list) logic in the handling of and and or is incomplete. The bifurcated vars must be merged together into the original vars. Without this, it looks as if the operator didn't bind any variables, and they can be repeated again without backreferencing. In the broken examples, variable a is taking on the value 2 instead of mismatching the previous value of 1.
-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 0068eabb..46fc2719 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -90,6 +90,10 @@
(test (when-match @(or @(require @a (oddp a)) @b @c) 2 (list a b c))
(nil 2 nil))
+(test (if-match (@(or @a) @a) '(1 2) a :no) :no)
+(test (if-match (@(and @a) @a) '(1 2) a :no) :no)
+
+
(test
(collect-each ((obj (list '(1 2 3)
'(4 5)