summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-02-19 23:32:41 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-19 23:32:41 +0100
commit7e404c670d5ff55f4316b2ae0a6749161c4bb47d (patch)
treee383753f428f2dee8a0d81a974e26832ecf796ec /tests/destructor
parent68ce92d4eb6143b8c49001f4782b74eb98027c77 (diff)
downloadNim-7e404c670d5ff55f4316b2ae0a6749161c4bb47d.tar.gz
gc:destructors: add first test program
Diffstat (limited to 'tests/destructor')
-rw-r--r--tests/destructor/tgcdestructors.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/destructor/tgcdestructors.nim b/tests/destructor/tgcdestructors.nim
new file mode 100644
index 000000000..60d7fc14f
--- /dev/null
+++ b/tests/destructor/tgcdestructors.nim
@@ -0,0 +1,17 @@
+discard """
+  cmd: '''nim c --gc:destructors $file'''
+  output: '''1 1'''
+"""
+
+import allocators
+include system / ansi_c
+
+proc main =
+  var s: seq[string] = @[]
+  for i in 0..<80: s.add "foo"
+
+main()
+
+#echo s
+let (a, d) = allocCounters()
+cprintf("%ld %ld\n", a, d)