diff options
author | Miran <narimiran@users.noreply.github.com> | 2018-10-10 10:21:38 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-10 10:21:38 +0200 |
commit | 462bff48b22adf1415232e6da74698c69c88e949 (patch) | |
tree | a023c34a569e316259e2cc4e97b6608370774c52 | |
parent | 77f836b403af0bb130368ba05c96799393b2eeb9 (diff) | |
download | Nim-462bff48b22adf1415232e6da74698c69c88e949.tar.gz |
Iter test: closes #3819 (#9272)
-rw-r--r-- | tests/iter/titer11.nim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/iter/titer11.nim b/tests/iter/titer11.nim new file mode 100644 index 000000000..6c410e945 --- /dev/null +++ b/tests/iter/titer11.nim @@ -0,0 +1,28 @@ +discard """ + file: "titer11.nim" + output: '''[ +1 +2 +3 +] +''' +""" + +proc represent(i: int): iterator(): string = + result = iterator(): string = + yield $i + +proc represent(s: seq[int]): iterator(): string = + result = iterator(): string = + yield "[" + for i in s: + var events = represent(i) + for event in events(): + yield event + yield "]" + +let s = @[1, 2, 3] +var output = represent(s) + +for item in output(): + echo item |