summary refs log tree commit diff stats
path: root/tests/destructor
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-06-20 11:29:30 +0200
committerAraq <rumpf_a@web.de>2019-06-20 11:31:21 +0200
commit678beb8ef982a3477018ff7c8669c4a9c6f77545 (patch)
treeee50c9157f531dffcefb8794e75e54d33f7c73e6 /tests/destructor
parent6adcc09877c94ef0d89bca92481350b222dbcbc3 (diff)
downloadNim-678beb8ef982a3477018ff7c8669c4a9c6f77545.tar.gz
[other] newruntime: add a simple closure iterator test
Diffstat (limited to 'tests/destructor')
-rw-r--r--tests/destructor/tsimpleclosure.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/destructor/tsimpleclosure.nim b/tests/destructor/tsimpleclosure.nim
index df4c2c84b..c6d25d0b6 100644
--- a/tests/destructor/tsimpleclosure.nim
+++ b/tests/destructor/tsimpleclosure.nim
@@ -1,7 +1,8 @@
 discard """
   cmd: '''nim c --newruntime $file'''
   output: '''a b
-0 0  alloc/dealloc pairs: 0'''
+70
+2 2  alloc/dealloc pairs: 0'''
 """
 
 import core / allocators
@@ -13,10 +14,17 @@ proc main(): owned(proc()) =
   result = proc() =
     echo a, " ", b
 
+
+proc foo(f: (iterator(): int)) =
+  for i in f(): echo i
+
 proc wrap =
   let p = main()
   p()
 
+  let fIt = iterator(): int = yield 70
+  foo fIt
+
 wrap()
 let (a, d) = allocCounters()
 discard cprintf("%ld %ld  alloc/dealloc pairs: %ld\n", a, d, system.allocs)