summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-11-02 18:14:50 +0800
committerGitHub <noreply@github.com>2023-11-02 11:14:50 +0100
commitb68e0aab4c9c7db5df996ba1a4eb91ce7c82b8c6 (patch)
tree75d1601eb3a960c6fdf911233a0f5d58b0a29ee5 /tests
parent40e33dec45b98e1c5385f844e241011a8351d364 (diff)
downloadNim-b68e0aab4c9c7db5df996ba1a4eb91ce7c82b8c6.tar.gz
fixes #22866; fixes #19998; ensure destruction for Object construction with custom destructors (#22901)
fixes #22866;
fixes #19998
Diffstat (limited to 'tests')
-rw-r--r--tests/arc/tcomputedgoto.nim15
-rw-r--r--tests/arc/tcomputedgotocopy.nim11
2 files changed, 16 insertions, 10 deletions
diff --git a/tests/arc/tcomputedgoto.nim b/tests/arc/tcomputedgoto.nim
index 541a748c6..07487684a 100644
--- a/tests/arc/tcomputedgoto.nim
+++ b/tests/arc/tcomputedgoto.nim
@@ -1,16 +1,19 @@
 discard """
-  cmd: '''nim c --gc:arc $file'''
-  output: '''2
-2'''
+  cmd: '''nim c --mm:arc $file'''
+  output: '''
+2
+2
+destroyed
+'''
 """
 
 type
   ObjWithDestructor = object
     a: int
-proc `=destroy`(self: var ObjWithDestructor) =
+proc `=destroy`(self: ObjWithDestructor) =
   echo "destroyed"
 
-proc `=`(self: var ObjWithDestructor, other: ObjWithDestructor) =
+proc `=copy`(self: var ObjWithDestructor, other: ObjWithDestructor) =
   echo "copied"
 
 proc test(a: range[0..1], arg: ObjWithDestructor) =
@@ -38,4 +41,4 @@ proc test(a: range[0..1], arg: ObjWithDestructor) =
       if iteration == 2:
         break
 
-test(1, ObjWithDestructor())
\ No newline at end of file
+test(1, ObjWithDestructor())
diff --git a/tests/arc/tcomputedgotocopy.nim b/tests/arc/tcomputedgotocopy.nim
index 8337123ba..07487684a 100644
--- a/tests/arc/tcomputedgotocopy.nim
+++ b/tests/arc/tcomputedgotocopy.nim
@@ -1,13 +1,16 @@
 discard """
-  cmd: '''nim c --gc:arc $file'''
-  output: '''2
-2'''
+  cmd: '''nim c --mm:arc $file'''
+  output: '''
+2
+2
+destroyed
+'''
 """
 
 type
   ObjWithDestructor = object
     a: int
-proc `=destroy`(self: var ObjWithDestructor) =
+proc `=destroy`(self: ObjWithDestructor) =
   echo "destroyed"
 
 proc `=copy`(self: var ObjWithDestructor, other: ObjWithDestructor) =