summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-11-29 00:19:27 +0100
committerAraq <rumpf_a@web.de>2017-11-29 00:19:27 +0100
commitc00de13e1ff10775ff5979e057031e17cb646dfd (patch)
tree04459a77417c13b46aef22b111113bbb05cf2f7d
parentd0659319913ef25a45ab26491f5ccc688770c70f (diff)
downloadNim-c00de13e1ff10775ff5979e057031e17cb646dfd.tar.gz
closes #985
-rw-r--r--tests/destructor/tmove_objconstr.nim26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/destructor/tmove_objconstr.nim b/tests/destructor/tmove_objconstr.nim
index 20dc062f9..8aa12ed05 100644
--- a/tests/destructor/tmove_objconstr.nim
+++ b/tests/destructor/tmove_objconstr.nim
@@ -1,7 +1,12 @@
 
 discard """
 output:  '''test created
-test destroyed 0'''
+test destroyed 0
+1
+2
+3
+4
+Pony is dying!'''
   cmd: '''nim c --newruntime $file'''
 """
 
@@ -33,3 +38,22 @@ proc main =
 
 when isMainModule:
   main()
+
+# bug #985
+
+type
+    Pony = object
+        name: string
+
+proc `=destroy`(o: var Pony) =
+  echo "Pony is dying!"
+
+proc getPony: Pony =
+    result.name = "Sparkles"
+
+iterator items(p: Pony): int =
+    for i in 1..4:
+        yield i
+
+for x in getPony():
+    echo x