summary refs log tree commit diff stats
path: root/tests/destructor/tsimpletable.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/destructor/tsimpletable.nim')
-rw-r--r--tests/destructor/tsimpletable.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/destructor/tsimpletable.nim b/tests/destructor/tsimpletable.nim
new file mode 100644
index 000000000..36546b9f6
--- /dev/null
+++ b/tests/destructor/tsimpletable.nim
@@ -0,0 +1,24 @@
+discard """
+  cmd: '''nim c --newruntime $file'''
+  output: '''(field: "value")
+3 3  new: 0'''
+"""
+
+import core / allocators
+import system / ansi_c
+
+import tables
+
+type
+  Node = ref object
+    field: string
+
+proc main =
+  var w = newTable[string, owned Node]()
+  w["key"] = Node(field: "value")
+  echo w["key"][]
+
+main()
+
+let (a, d) = allocCounters()
+discard cprintf("%ld %ld  new: %ld\n", a, d, allocs)