summaryrefslogtreecommitdiffstats
path: root/tests/011/patmatch.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-25 11:04:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-25 11:04:11 -0700
commita96d1e927faba7300a3bc4108ff93af97707c947 (patch)
treeef2176ed392334d523d299588bae2855231e9a06 /tests/011/patmatch.tl
parent8280c77142467d28cafcf2f79dfdb64861f01632 (diff)
downloadtxr-a96d1e927faba7300a3bc4108ff93af97707c947.tar.gz
txr-a96d1e927faba7300a3bc4108ff93af97707c947.tar.bz2
txr-a96d1e927faba7300a3bc4108ff93af97707c947.zip
match: third round of quasi tests and fixes.
* share/txr/stdlib/match.tl (expand-quasi-match): Add case fo r unbound var followed by var, followed by nothing. * tests/011/patmatch.tl: New tests.
Diffstat (limited to 'tests/011/patmatch.tl')
-rw-r--r--tests/011/patmatch.tl14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl
index c40d5ea5..e9685b87 100644
--- a/tests/011/patmatch.tl
+++ b/tests/011/patmatch.tl
@@ -350,10 +350,24 @@
(test (when-match `#@a-$` "#a-$" a) "a")
(test (when-match `#@a-$` "#a-$$" a) nil)
(test (when-match `#@a-$` "#a-" a) nil)
+(test (when-match `#@a-@b` "#a-$" (list a b)) ("a" "$"))
(test (when-match `#@{a #/ab*c/}` "#abbbc" a) "abbbc")
(test (when-match `#@{a #/ab*c/}d` "#abbbcd" a) "abbbc")
(test (when-match `#@{a 3}@b` "#abb" a) "abb")
(test (when-match `#@{a 3}@b` "#abbbc" (list a b)) ("abb" "bc"))
+(test (when-match `#@{a 4}@b` "#abb" a) nil)
+(test (when-match `#@{a 3}` "#abb" a) "abb")
+(test (when-match `#@{a 2}` "#abb" a) nil)
+(test (when-match `#@{a 4}` "#abb" a) nil)
+
+(macro-time-let ((*stderr* *stdnull*))
+ (test (when-match `#@{a 4 5}` "#abb" a) :error))
+
+(let ((b "bcd"))
+ (test (when-match `@a@b` "abcd" a) "a")
+ (test (when-match `@a@{b [1..:]}` "acd" a) "a")
+ (test (when-match `@a@{b [1..:]}` "abcd" a) "ab")
+ (test (when-match `@a@{b [0..1]}` "abcd" a) nil))
(compile-only
(eval-only