newruntime: added yet another test
This commit is contained in:
parent
c65a5d754b
commit
0adb1c6223
1 changed files with 22 additions and 0 deletions
22
tests/destructor/tsimpleclosure.nim
Normal file
22
tests/destructor/tsimpleclosure.nim
Normal 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)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue