diff options
Diffstat (limited to 'tests/destructor/twidgets_unown.nim')
-rw-r--r-- | tests/destructor/twidgets_unown.nim | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/destructor/twidgets_unown.nim b/tests/destructor/twidgets_unown.nim index 5e53a0e5b..8653d5c28 100644 --- a/tests/destructor/twidgets_unown.nim +++ b/tests/destructor/twidgets_unown.nim @@ -1,11 +1,10 @@ discard """ - cmd: '''nim c --newruntime $file''' + cmd: '''nim c -d:nimAllocStats --newruntime $file''' output: '''button clicked! -3 3 alloc/dealloc pairs: 0''' +(allocCount: 6, deallocCount: 6)''' """ -import core / allocators import system / ansi_c type @@ -52,8 +51,10 @@ proc main = var b = newButton("button", nil) let u = unown b + var clicked = "clicked" b.onclick = proc () = - b.caption = "clicked!" + clicked.add "!" + u.caption = clicked w.add b w.draw() @@ -67,7 +68,5 @@ proc main = if a != nil: a() -main() - -let (a, d) = allocCounters() -discard cprintf("%ld %ld alloc/dealloc pairs: %ld\n", a, d, allocs) +dumpAllocStats: + main() |