summary refs log tree commit diff stats
path: root/tests/cpp
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-12-12 14:08:01 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-12-12 14:08:01 +0100
commite169eaac5be10d720cb4fb8f15fb17a84e4725d1 (patch)
tree8979dce4dbef64c4fd9b50ea71ec15acfa72754d /tests/cpp
parent34143ee12285c55d0773ea8ebda38b95351c6592 (diff)
downloadNim-e169eaac5be10d720cb4fb8f15fb17a84e4725d1.tar.gz
make tsigbreak.nim compile
Diffstat (limited to 'tests/cpp')
-rw-r--r--tests/cpp/tsigbreak.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/cpp/tsigbreak.nim b/tests/cpp/tsigbreak.nim
new file mode 100644
index 000000000..c8044f2bf
--- /dev/null
+++ b/tests/cpp/tsigbreak.nim
@@ -0,0 +1,28 @@
+discard """
+  cmd: "nim cpp $file"
+"""
+
+import tables, lists
+
+type
+  ListTable[K, V] = object
+    table: Table[K, DoublyLinkedNode[V]]
+
+proc initListTable*[K, V](initialSize = 64): ListTable[K, V] =
+  result.table = initTable[K, DoublyLinkedNode[V]]()
+
+proc `[]=`*[K, V](t: var ListTable[K, V], key: K, val: V) =
+  t.table[key].value = val
+
+type
+  SomeObj = object
+  OtherObj = object
+
+proc main() =
+  var someTable = initListTable[int, SomeObj]()
+  var otherTable = initListTable[int, OtherObj]()
+
+  someTable[1] = SomeObj()
+  otherTable[42] = OtherObj()
+
+main()