diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-26 07:44:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-26 07:44:54 -0700 |
commit | 572f13d7b95bb265fed622b4e4c9a1ed11eefcc4 (patch) | |
tree | e0b87d942dca7a00403488dc4236b6d8e0fe6e53 /tests | |
parent | 80adc0257a941ccda132ca04a15ed98727fd8199 (diff) | |
download | txr-572f13d7b95bb265fed622b4e4c9a1ed11eefcc4.tar.gz txr-572f13d7b95bb265fed622b4e4c9a1ed11eefcc4.tar.bz2 txr-572f13d7b95bb265fed622b4e4c9a1ed11eefcc4.zip |
matcher: add some test variants.
* tests/011/patmatch.tl: Add variants based on existing tests
which insert an extra character at the left that is matched by
a bound variable. This tests that the remainder of the pattern
is following the offset numeric position within the string.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/011/patmatch.tl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/011/patmatch.tl b/tests/011/patmatch.tl index 54dda990..6cb00157 100644 --- a/tests/011/patmatch.tl +++ b/tests/011/patmatch.tl @@ -364,6 +364,20 @@ (test (when-match `#@{a 2}` "#abb" a) nil) (test (when-match `#@{a 4}` "#abb" a) nil) +(let ((z 0)) + (test (when-match `@z#@a-$` "0#a-$" a) "a") + (test (when-match `@z#@a-$` "0#a-$$" a) nil) + (test (when-match `@z#@a-$` "0#a-" a) nil) + (test (when-match `@z#@a-@b` "0#a-$" (list a b)) ("a" "$")) + (test (when-match `@z#@{a #/ab*c/}` "0#abbbc" a) "abbbc") + (test (when-match `@z#@{a #/ab*c/}d` "0#abbbcd" a) "abbbc") + (test (when-match `@z#@{a 3}@b` "0#abb" a) "abb") + (test (when-match `@z#@{a 3}@b` "0#abbbc" (list a b)) ("abb" "bc")) + (test (when-match `@z#@{a 4}@b` "0#abb" a) nil) + (test (when-match `@z#@{a 3}` "0#abb" a) "abb") + (test (when-match `@z#@{a 2}` "0#abb" a) nil) + (test (when-match `@z#@{a 4}` "0#abb" a) nil)) + (macro-time-let ((*stderr* *stdnull*)) (test (when-match `#@{a 4 5}` "#abb" a) :error)) @@ -374,11 +388,15 @@ (test (when-match `@a@{b [0..1]}` "abcd" a) nil) (test (when-match `@a@{b [0..2]}d` "abcd" a) "a")) -(let ((x 123)) +(let ((x 123) (z 0)) (test (when-match `^@{x 5}$` "^123 $" t) t) (test (when-match `^@{x -5}$` "^ 123$" t) t) (test (when-match `@x@x` "123123" t) t) - (test (when-match `@x@{x [1..:]}` "12323" t) t)) + (test (when-match `@x@{x [1..:]}` "12323" t) t) + (test (when-match `@z^@{x 5}$` "0^123 $" t) t) + (test (when-match `@z^@{x -5}$` "0^ 123$" t) t) + (test (when-match `@z@x@x` "0123123" t) t) + (test (when-match `@z@x@{x [1..:]}` "012323" t) t)) (let ((a "$")) (test (when-match `@a-@b` "$-@" b) "@")) |