From 678beb8ef982a3477018ff7c8669c4a9c6f77545 Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 20 Jun 2019 11:29:30 +0200 Subject: [other] newruntime: add a simple closure iterator test --- tests/destructor/tsimpleclosure.nim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tests/destructor') 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) -- cgit 1.4.1-2-gfad0 ahoang <ahoang@tilde.institute>
summary refs log blame commit diff stats
path: root/.gitlab-ci.yml
blob: 76c94c8e75dc90af6aa94d0919d5a0c795fa1250 (plain) (tree)
1
2
3
4
5
6