summary refs log tree commit diff stats
path: root/tests/destructor/tv2_raise.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/destructor/tv2_raise.nim')
-rw-r--r--tests/destructor/tv2_raise.nim25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/destructor/tv2_raise.nim b/tests/destructor/tv2_raise.nim
index f8d6d30b5..66b0aec30 100644
--- a/tests/destructor/tv2_raise.nim
+++ b/tests/destructor/tv2_raise.nim
@@ -1,12 +1,12 @@
 discard """
-  cmd: '''nim c --newruntime $file'''
-  output: '''OK 2
-4 1'''
+  valgrind: true
+  cmd: '''nim c -d:nimAllocStats --newruntime $file'''
+  output: '''OK 3
+(allocCount: 7, deallocCount: 4)'''
 """
 
 import strutils, math
 import system / ansi_c
-import core / allocators
 
 proc mainA =
   try:
@@ -36,7 +36,18 @@ except ValueError:
 except:
   discard
 
-echo "OK ", ok
+#  bug #11577
+
+proc newError*: owned(ref Exception) {.noinline.} =
+  new(result)
+
+proc mainC =
+  raise newError()
+
+try:
+  mainC()
+except:
+  inc ok
 
-let (a, d) = allocCounters()
-discard cprintf("%ld %ld\n", a, d)
+echo "OK ", ok
+echo getAllocStats()