From 51ac2e67bf53f299b3ca54614ef62afc021323bb Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Tue, 11 Jun 2019 08:58:11 +0200 Subject: [PATCH] newruntime: added a basic table test --- tests/destructor/tsimpletable.nim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/destructor/tsimpletable.nim diff --git a/tests/destructor/tsimpletable.nim b/tests/destructor/tsimpletable.nim new file mode 100644 index 0000000000..36546b9f6a --- /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)