summary refs log tree commit diff stats
path: root/tests/controlflow
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-08-20 02:14:30 +0200
committerAraq <rumpf_a@web.de>2014-08-20 02:14:30 +0200
commit15b2d6d351ab96eb2f84e466d1cebd04f70448c8 (patch)
tree5cb8ab6e0f41e7f83a9551944cfde287a617d9d2 /tests/controlflow
parentbc2e83fe170bdd01b2f251405702f69366a63107 (diff)
downloadNim-15b2d6d351ab96eb2f84e466d1cebd04f70448c8.tar.gz
fixes #1418
Diffstat (limited to 'tests/controlflow')
-rw-r--r--tests/controlflow/tbreak.nim33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/controlflow/tbreak.nim b/tests/controlflow/tbreak.nim
new file mode 100644
index 000000000..3d6bb25f0
--- /dev/null
+++ b/tests/controlflow/tbreak.nim
@@ -0,0 +1,33 @@
+discard """
+  output: '''10'''
+"""
+
+var
+  x = false
+  run = true
+
+while run:
+  run = false
+  block myblock:
+    if true:
+      break
+    echo "leaving myblock"
+  x = true
+doAssert(x)
+
+# bug #1418
+iterator foo: int =
+  for x in 0 .. 9:
+    for y in [10,20,30,40,50,60,70,80,90]:
+      yield x + y
+
+for p in foo():
+  echo p
+  break
+
+iterator permutations: int =
+  yield 10
+
+for p in permutations():
+  break
+