fix #9437(fix re.replace wrong behaviour) (#17546)

* fix nim js cmp fails at CT

* fix
This commit is contained in:
flywind
2021-06-11 00:26:58 +08:00
committed by GitHub
parent f65f760dee
commit 6b97889f44
2 changed files with 24 additions and 5 deletions

View File

@@ -99,10 +99,13 @@ proc testAll() =
accum.add($x)
doAssert(accum == @["a","b","c"])
block:
# bug #9306
block: # bug #9306
doAssert replace("bar", re"^", "foo") == "foobar"
doAssert replace("foo", re"", "-") == "-foo"
doAssert replace("foo", re"$", "bar") == "foobar"
block: # bug #9437
doAssert replace("foo", re"", "-") == "-f-o-o-"
doAssert replace("ooo", re"o", "-") == "---"
testAll()