parent
8bdcade1a0
commit
ca0155a458
2 changed files with 30 additions and 3 deletions
|
|
@ -320,9 +320,13 @@ proc rawGetTok(c: var CfgParser, tok: var Token) =
|
||||||
tok.literal = "="
|
tok.literal = "="
|
||||||
of '-':
|
of '-':
|
||||||
inc(c.bufpos)
|
inc(c.bufpos)
|
||||||
if c.buf[c.bufpos] == '-': inc(c.bufpos)
|
if c.buf[c.bufpos] == '-':
|
||||||
tok.kind = tkDashDash
|
inc(c.bufpos)
|
||||||
tok.literal = "--"
|
tok.kind = tkDashDash
|
||||||
|
tok.literal = "--"
|
||||||
|
else:
|
||||||
|
dec(c.bufpos)
|
||||||
|
getSymbol(c, tok)
|
||||||
of ':':
|
of ':':
|
||||||
tok.kind = tkColon
|
tok.kind = tkColon
|
||||||
inc(c.bufpos)
|
inc(c.bufpos)
|
||||||
|
|
|
||||||
23
tests/stdlib/tparsecfg.nim
Normal file
23
tests/stdlib/tparsecfg.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
discard """
|
||||||
|
output: '''OK'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
#bug #6046
|
||||||
|
import parsecfg
|
||||||
|
|
||||||
|
var config = newConfig()
|
||||||
|
config.setSectionKey("foo","bar","-1")
|
||||||
|
config.setSectionKey("foo","foo","abc")
|
||||||
|
config.writeConfig("test.ini")
|
||||||
|
|
||||||
|
# test.ini now contains
|
||||||
|
# [foo]
|
||||||
|
# bar=-1
|
||||||
|
# foo=abc
|
||||||
|
|
||||||
|
var config2 = loadConfig("test.ini")
|
||||||
|
let bar = config2.getSectionValue("foo","bar")
|
||||||
|
let foo = config2.getSectionValue("foo","foo")
|
||||||
|
assert(bar == "-1")
|
||||||
|
assert(foo == "abc")
|
||||||
|
echo "OK"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue