diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-06-20 08:38:29 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-06-20 08:38:29 +0200 |
commit | 0adb1c6223adf58329e1a9cd0d92c3493e00eafa (patch) | |
tree | 59a5fc47737fedf02a8bb61da91f25a604f7a81f | |
parent | c65a5d754b791dfad72420fa27cfe933c6a7782c (diff) | |
download | Nim-0adb1c6223adf58329e1a9cd0d92c3493e00eafa.tar.gz |
newruntime: added yet another test
-rw-r--r-- | tests/destructor/tsimpleclosure.nim | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/destructor/tsimpleclosure.nim b/tests/destructor/tsimpleclosure.nim new file mode 100644 index 000000000..df4c2c84b --- /dev/null +++ b/tests/destructor/tsimpleclosure.nim @@ -0,0 +1,22 @@ +discard """ + cmd: '''nim c --newruntime $file''' + output: '''a b +0 0 alloc/dealloc pairs: 0''' +""" + +import core / allocators +import system / ansi_c + +proc main(): owned(proc()) = + var a = "a" + var b = "b" + result = proc() = + echo a, " ", b + +proc wrap = + let p = main() + p() + +wrap() +let (a, d) = allocCounters() +discard cprintf("%ld %ld alloc/dealloc pairs: %ld\n", a, d, system.allocs) |