summary refs log tree commit diff stats
path: root/tests/accept/compile/tparscfg.nim
diff options
context:
space:
mode:
authorrumpf_a@web.de <>2010-02-21 19:42:36 +0100
committerrumpf_a@web.de <>2010-02-21 19:42:36 +0100
commitd913fdb2800d83680e413cd8a5f07b7f85deac6e (patch)
tree09a284861adf96520059f211ba8bae1a76294a9c /tests/accept/compile/tparscfg.nim
parent6bc16904edd3738ab97573b9eeb3a6a7cce9574c (diff)
downloadNim-d913fdb2800d83680e413cd8a5f07b7f85deac6e.tar.gz
start of tests refactoring; sqlite3 new wrapper fixes
Diffstat (limited to 'tests/accept/compile/tparscfg.nim')
-rw-r--r--tests/accept/compile/tparscfg.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/accept/compile/tparscfg.nim b/tests/accept/compile/tparscfg.nim
new file mode 100644
index 000000000..618ecadd6
--- /dev/null
+++ b/tests/accept/compile/tparscfg.nim
@@ -0,0 +1,25 @@
+
+import
+  os, parsecfg, strutils, streams
+  
+var f = newFileStream(paramStr(1), fmRead)
+if f != nil:
+  var p: TCfgParser
+  open(p, f, paramStr(1))
+  while true:
+    var e = next(p)
+    case e.kind
+    of cfgEof: 
+      echo("EOF!")
+      break
+    of cfgSectionStart:   ## a ``[section]`` has been parsed
+      echo("new section: " & e.section)
+    of cfgKeyValuePair:
+      echo("key-value-pair: " & e.key & ": " & e.value)
+    of cfgOption:
+      echo("command: " & e.key & ": " & e.value)
+    of cfgError:
+      echo(e.msg)
+  close(p)
+else:
+  echo("cannot open: " & paramStr(1))