tparsecfg.nim 434 B

123456789101112131415161718192021222324
  1. discard """
  2. output: '''OK'''
  3. """
  4. #bug #6046
  5. import parsecfg
  6. var config = newConfig()
  7. config.setSectionKey("foo","bar","-1")
  8. config.setSectionKey("foo","foo","abc")
  9. config.writeConfig("test.ini")
  10. # test.ini now contains
  11. # [foo]
  12. # bar=-1
  13. # foo=abc
  14. var config2 = loadConfig("test.ini")
  15. let bar = config2.getSectionValue("foo","bar")
  16. let foo = config2.getSectionValue("foo","foo")
  17. assert(bar == "-1")
  18. assert(foo == "abc")
  19. echo "OK"