summaryrefslogtreecommitdiffstats
path: root/tests/010
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-27 07:36:01 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-27 07:36:01 -0800
commitf9bcbd884bb1cd60144f13df3de00516b731827c (patch)
tree0d8f9badb6203c43652853bf8c127f8b1cc53114 /tests/010
parent8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3 (diff)
downloadtxr-f9bcbd884bb1cd60144f13df3de00516b731827c.tar.gz
txr-f9bcbd884bb1cd60144f13df3de00516b731827c.tar.bz2
txr-f9bcbd884bb1cd60144f13df3de00516b731827c.zip
txr: do not ignore regex in positive match.
* match.c (h_var): Refactor the logic here a bit. Without regard for whether the variable has a value, we dispatch the regex, fixed field and function cases. These handle the binding against the existing value. Then before all other cases, we check for the existing value and convert that to a literal text match. The effect of this is that now the regular expression is processed even if the variable has a value. * tests/010/span-var.txr: Last two test cases hardened a bit so they cannot fall through to a successful exit, if they invoke the wrong case. This is not related to this change. New test cases for regex span. * txr.1: Updated documentation and compatibility notes.
Diffstat (limited to 'tests/010')
-rw-r--r--tests/010/span-var.txr11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/010/span-var.txr b/tests/010/span-var.txr
index b7142b79..036acc6a 100644
--- a/tests/010/span-var.txr
+++ b/tests/010/span-var.txr
@@ -17,12 +17,23 @@
@(bind d ("d"))
@(cases)
@ {d (fun "x" "a")}
+@ {require (not "get here")}
@(or)
@ (require "get here")
@(end)
@(next :string "ab")
@(cases)
@ {d (fun2 "x" "a")}
+@ {require (not "get here")}
@(or)
@ (require "get here")
@(end)
+@(bind n "123")
+@(next :string "123456")
+@(cases)
+@ {n /\d+/}
+@ {require (not "get here")}
+@(or)
+@ {m /\d+/}
+@ (require (equal m "123456"))
+@(end)