Fix skipping an empty match at the end
This commit is contained in:
parent
ec1758509c
commit
02c6e7306f
2 changed files with 5 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ suite "find":
|
|||
test "len 0 find":
|
||||
check("".findAll(re"\ ") == newSeq[string]())
|
||||
check("".findAll(re"") == @[""])
|
||||
check("abc".findAll(re"") == @["", "", "", ""])
|
||||
check("word word".findAll(re"\b") == @["", "", "", ""])
|
||||
check("word\r\lword".findAll(re(r"$", "m<anycrlf>")) == @["", ""])
|
||||
check("слово слово".findAll(re(r"\b", "uW")) == @["", "", "", ""])
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import unittest
|
|||
suite "replace":
|
||||
test "replace with 0-length strings":
|
||||
check("".replace(re"1", proc (v: RegexMatch): string = "1") == "")
|
||||
check(" ".replace(re"", proc (v: RegexMatch): string = "1") == "1 ")
|
||||
check(" ".replace(re"", proc (v: RegexMatch): string = "1") == "1 1")
|
||||
check("".replace(re"", proc (v: RegexMatch): string = "1") == "1")
|
||||
|
||||
test "regular replace":
|
||||
|
|
|
|||
Loading…
Reference in a new issue