Add a test-case for #12990 (#15072)

* closes #12990
* Add a test-case for #12990
This commit is contained in:
Danil Yarantsev
2020-07-25 21:35:20 +03:00
committed by GitHub
parent 2aca748ddd
commit 080bed8b6b
2 changed files with 16 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
# bug #14219
var vectors = @["a", "b", "c", "d", "e"]
iterator testVectors(): string =
@@ -7,4 +8,14 @@ iterator testVectors(): string =
var r = ""
for item in testVectors():
r.add item
echo r
echo r
# bug #12990
iterator test(): int {.closure.} =
yield 0
let x = test
while true:
let val = x()
if finished(x): break
echo val

View File

@@ -1,5 +1,8 @@
discard """
output: "abcde"
output: '''
abcde
0
'''
cmd: "nim c --gc:arc $file"
"""