summary refs log tree commit diff stats
path: root/tests/coroutines/titerators.nim
diff options
context:
space:
mode:
authorRokas Kupstys <rokups@zoho.com>2017-02-24 10:51:54 +0200
committerRokas Kupstys <rokups@zoho.com>2017-02-24 10:51:54 +0200
commit9df0000621d528309cdaae67e0d203d9fdff57c3 (patch)
tree4a7f09385b65793916118fb59c4763ee32ec74ed /tests/coroutines/titerators.nim
parent5aef77a3d3a0c2c8997fbb08163c0730a2742784 (diff)
downloadNim-9df0000621d528309cdaae67e0d203d9fdff57c3.tar.gz
Proper use of sequences in coroutine tests
Diffstat (limited to 'tests/coroutines/titerators.nim')
-rw-r--r--tests/coroutines/titerators.nim6
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/coroutines/titerators.nim b/tests/coroutines/titerators.nim
index c263b49db..e2623ce2d 100644
--- a/tests/coroutines/titerators.nim
+++ b/tests/coroutines/titerators.nim
@@ -3,8 +3,7 @@ include system/timers
 
 var
   stackCheckValue = 1100220033
-  numbers = newSeq[int](10)
-  i = 0
+  numbers = newSeqOfCap[int](10)
 
 iterator theIterator(id: int, sleep: float): int =
   for i in 0..<5:
@@ -13,8 +12,7 @@ iterator theIterator(id: int, sleep: float): int =
 
 proc theCoroutine(id: int, sleep: float32) =
   for n in theIterator(id, sleep):
-    numbers[i] = n
-    inc(i)
+    numbers.add(n)
 
 var start = getTicks()
 start(proc() = theCoroutine(1, 0.01))