Fix zero-length matches for multibyte characters
This commit is contained in:
parent
a665279192
commit
16577f8167
3 changed files with 8 additions and 5 deletions
|
|
@ -19,4 +19,6 @@ suite "find":
|
|||
test "len 0 find":
|
||||
check("".findAll(re"\ ") == newSeq[string]())
|
||||
check("".findAll(re"") == @[""])
|
||||
check("word word".findAll(nre.re"\b") == @["", "", "", ""])
|
||||
check("word word".findAll(re"\b") == @["", "", "", ""])
|
||||
check("word\r\lword".findAll(re(r"$", "m<anycrlf>")) == @["", ""])
|
||||
check("слово слово".findAll(re(r"\b", "uW")) == @["", "", "", ""])
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@ suite "Misc tests":
|
|||
test "unicode":
|
||||
check("".find(re("", "8")).match == "")
|
||||
check("перевірка".replace(re(r"\w", "uW"), "") == "")
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ suite "string splitting":
|
|||
check("12345".split(re("")) == @["1", "2", "3", "4", "5"])
|
||||
check("".split(re"") == newSeq[string]())
|
||||
check("word word".split(re"\b") == @["word", " ", "word"])
|
||||
check("word\r\lword".split(re(r"$", "m<anycrlf>")) == @["word", "\r\lword"])
|
||||
check("слово слово".split(re(r"(\b)", "uW")) == @["", "слово", "", " ", "", "слово", ""])
|
||||
|
||||
test "perl split tests":
|
||||
check("forty-two" .split(re"") .join(",") == "f,o,r,t,y,-,t,w,o")
|
||||
|
|
|
|||
Loading…
Reference in a new issue