diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-04-27 21:16:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-04-27 21:16:08 -0700 |
commit | 3717be6b0d5eb45213fd5d277662d3b32abadeaf (patch) | |
tree | fa6a83c0fce811cff2f965cca11a6829ffe8848e /tests | |
parent | 641120932ab1f9e88c77c9a9d3043ed8f8e2faeb (diff) | |
download | txr-3717be6b0d5eb45213fd5d277662d3b32abadeaf.tar.gz txr-3717be6b0d5eb45213fd5d277662d3b32abadeaf.tar.bz2 txr-3717be6b0d5eb45213fd5d277662d3b32abadeaf.zip |
match-str: tests and bugfix.
* lib.c (do_match_str): Fix wrong return value calculation
in LSTR-LSTR case.
* tests/015/match-str.tl: New file.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/015/match-str.tl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/015/match-str.tl b/tests/015/match-str.tl new file mode 100644 index 00000000..53e2c73a --- /dev/null +++ b/tests/015/match-str.tl @@ -0,0 +1,41 @@ +(load "../common") + +(defun lz (str) + (lazy-str (spl "" str) "")) + +(defun lz* (str) + (lazy-str (append (spl "" str) 42) "")) + +(mtest + (match-str "" "") 0 + (match-str "a" "a") 1 + (match-str "a" "") 0 + (match-str "a" "" 1) 1 + (match-str "a" "" 2) nil + (match-str "abc" "c" 2) 3 + (match-str "abc" "b" 1) 2 + (match-str "abc" "a" 0) 1 + (match-str "abc" "b" 2) nil + (match-str "abc" "a" 1) nil + (match-str "abc" "c" 0) nil + (match-str "abc" "c" 3) nil + (match-str "abc" "c" 4) nil + (match-str "abc" "abcd") nil) + +(mtest + (match-str (lz* "abc#") "c" 2) 3 + (match-str "abc#" (lz "c") 2) 3 + (match-str (lz* "abc#") (lz "c") 2) 3 + (match-str (lz "abc") (lz "c") 2) 3 + (match-str (lz "abc") (lz "b") 1) 2 + (match-str (lz "abc") (lz "a") 0) 1 + (match-str (lz "abc") (lz "b") 2) nil + (match-str (lz "abc") (lz "a") 1) nil + (match-str (lz "abc") (lz "c") 0) nil + (match-str (lz "abc") (lz "c") 3) nil + (match-str (lz "abc") (lz "c") 4) nil + (match-str (lz "abc") (lz "abcd")) nil) + +(mtest + (match-str "" "" -1) nil + (match-str "" "" -1) nil) |