newruntime: added yet another test

(cherry picked from commit 0adb1c6223)
This commit is contained in:
Andreas Rumpf
2019-06-20 08:38:29 +02:00
committed by narimiran
parent aacc97e854
commit 905fc43abe

View File

@@ -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)