fix ropes format errors (#16106) [backport:1.0]

* fix rope index

* add testcase

* fix ropes format

(cherry picked from commit 0c6c4be0e7)
This commit is contained in:
flywind
2020-11-24 02:23:52 +08:00
committed by narimiran
parent 62d497237a
commit 1eda325177
2 changed files with 8 additions and 1 deletions

View File

@@ -64,3 +64,10 @@ block:
inc i
doAssert r[66] == '\0'
block:
let r1 = "$1 $2 $3" % [rope("Nim"), rope("is"), rope("a great language")]
doAssert $r1 == "Nim is a great language"
let r2 = "$# $# $#" % [rope("Nim"), rope("is"), rope("a great language")]
doAssert $r2 == "Nim is a great language"