summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-06-11 08:58:11 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-06-11 08:58:11 +0200
commit51ac2e67bf53f299b3ca54614ef62afc021323bb (patch)
tree57a4b9a97c7e17019b29c6f3a256c78a75894c6f /tests/destructor
parentced0527ae334439a10e1719d1eccb727c19dc781 (diff)
downloadNim-51ac2e67bf53f299b3ca54614ef62afc021323bb.tar.gz
newruntime: added a basic table test
Diffstat (limited to 'tests/destructor')
-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)