mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-19 11:07:14 +00:00
Merge pull request #3421 from jlp765/strtab1
fix #3416 strtabs clear() and []=
This commit is contained in:
@@ -173,6 +173,9 @@ proc clear*(s: StringTableRef, mode: StringTableMode) =
|
||||
s.mode = mode
|
||||
s.counter = 0
|
||||
s.data.setLen(startSize)
|
||||
for i in 0..<s.data.len:
|
||||
if not isNil(s.data[i].key):
|
||||
s.data[i].key = nil
|
||||
|
||||
proc newStringTable*(keyValuePairs: varargs[string],
|
||||
mode: StringTableMode): StringTableRef {.
|
||||
@@ -248,3 +251,6 @@ when isMainModule:
|
||||
x.mget("11") = "23"
|
||||
assert x["11"] == "23"
|
||||
|
||||
x.clear(modeCaseInsensitive)
|
||||
x["11"] = "22"
|
||||
assert x["11"] == "22"
|
||||
|
||||
Reference in New Issue
Block a user