summaryrefslogtreecommitdiffstats
path: root/tests/011
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-25 00:53:08 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-25 00:53:08 -0700
commitb8237da593d63f83dcf642322b3b2e2f4d72ae8b (patch)
tree9cf97d1211f28d5b3f7345993213ad679f0e4641 /tests/011
parent7c3505120e36ff9df3eae624c140b63d48d31bac (diff)
downloadtxr-b8237da593d63f83dcf642322b3b2e2f4d72ae8b.tar.gz
txr-b8237da593d63f83dcf642322b3b2e2f4d72ae8b.tar.bz2
txr-b8237da593d63f83dcf642322b3b2e2f4d72ae8b.zip
matcher: first round of quasi tests and bugfix.
* share/txr/stdlib/match.tl (expand-quasi-match): The return value of search-str isn't a length but an absolute position. We not only fix a bug, but lose a useless calculation. * tests/011/patmatch.tl: New test cases for quasiliteral patterns, starting with the most rudimentary. Last one broke, due to the above issue.
Diffstat (limited to 'tests/011')
-rw-r--r--tests/011/patmatch.tl10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index 09395eba..ad9015db 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -339,6 +339,16 @@
(test (when-match (@(var= a) @(var= a)) '(1 1.0) a) 1)
+(test (when-match `` "" t) t)
+(test (when-match `abc` "abc" t) t)
+(test (when-match `@a` "abc" a) "abc")
+
+(macro-time-let ((*stderr* *stdnull*))
+ (test (when-match `@a@b` "abc" a) :error))
+
+(test (when-match `@a-$` "a-$" a) "a")
+(test (when-match `#@a-$` "#a-$" a) "a")
+
(compile-only
(eval-only
(compile-file (base-name *load-path*) "temp.tlo")