summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-03-26 01:00:34 +0100
committerAraq <rumpf_a@web.de>2014-03-26 01:00:34 +0100
commitd15788d00a4007a80de4427f84129abe47fa4f11 (patch)
tree3dbe43bbca760f56bdb79c684f8d8af3bd60430f /tests
parent9e66d988e7fc1f33b11a0b93be484361390bd095 (diff)
downloadNim-d15788d00a4007a80de4427f84129abe47fa4f11.tar.gz
added #903 to the test suite
Diffstat (limited to 'tests')
-rw-r--r--tests/vm/tcompiletimetable.nim27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/vm/tcompiletimetable.nim b/tests/vm/tcompiletimetable.nim
index 3b40add07..f1d3ecd4e 100644
--- a/tests/vm/tcompiletimetable.nim
+++ b/tests/vm/tcompiletimetable.nim
@@ -12,13 +12,13 @@ import macros, tables
 var ZOOT{.compileTime.} = initTable[int, int](2)
 var iii {.compiletime.} = 1
 
-macro x:stmt=
+macro zoo:stmt=
   zoot[iii] = iii*2
   inc iii
   echo iii
 
-x
-x
+zoo
+zoo
 
 
 macro tupleUnpack: stmt =
@@ -27,3 +27,24 @@ macro tupleUnpack: stmt =
 
 tupleUnpack
 
+# bug #903
+
+import strtabs
+
+var x {.compileTime.}: PStringTable
+
+macro addStuff(stuff, body: expr): stmt {.immediate.} =
+  result = newNimNode(nnkStmtList)
+
+  if x.isNil:
+    x = newStringTable(modeStyleInsensitive)
+  x[$stuff] = ""
+
+macro dump(): stmt =
+  result = newNimNode(nnkStmtList)
+  for y in x.keys: echo "Got ", y
+
+addStuff("Hey"): echo "Hey"
+addStuff("Hi"): echo "Hi"
+dump()
+