summary refs log tree commit diff stats
path: root/tests/accept/compile/tloops.nim
diff options
context:
space:
mode:
authorrumpf_a@web.de <>2010-02-21 19:42:36 +0100
committerrumpf_a@web.de <>2010-02-21 19:42:36 +0100
commitd913fdb2800d83680e413cd8a5f07b7f85deac6e (patch)
tree09a284861adf96520059f211ba8bae1a76294a9c /tests/accept/compile/tloops.nim
parent6bc16904edd3738ab97573b9eeb3a6a7cce9574c (diff)
downloadNim-d913fdb2800d83680e413cd8a5f07b7f85deac6e.tar.gz
start of tests refactoring; sqlite3 new wrapper fixes
Diffstat (limited to 'tests/accept/compile/tloops.nim')
-rw-r--r--tests/accept/compile/tloops.nim64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/accept/compile/tloops.nim b/tests/accept/compile/tloops.nim
new file mode 100644
index 000000000..3d03256ad
--- /dev/null
+++ b/tests/accept/compile/tloops.nim
@@ -0,0 +1,64 @@
+# Test nested loops and some other things

+

+proc andTest() =

+  var a = 0 == 5 and 6 == 6

+

+proc incx(x: var int) = # is built-in proc

+  x = x + 1

+

+proc decx(x: var int) =

+  x = x - 1

+

+proc First(y: var int) =

+  var x: int

+  i_ncx(x)

+  if x == 10:

+    y = 0

+  else:

+    if x == 0:

+      incx(x)

+    else:

+      x=11

+

+proc TestLoops() =

+  var i, j: int

+  while i >= 0:

+    if i mod 3 == 0:

+      break

+    i = i + 1

+    while j == 13:

+      j = 13

+      break

+    break

+

+  while True:

+    break

+

+

+proc Foo(n: int): int =

+    var

+        a, old: int

+        b, c: bool

+    F_irst(a)

+    if a == 10:

+        a = 30

+    elif a == 11:

+        a = 22

+    elif a == 12:

+        a = 23

+    elif b:

+        old = 12

+    else:

+        a = 40

+

+    #

+    b = false or 2 == 0 and 3 == 9

+    a = 0 + 3 * 5 + 6 + 7 + +8 # 36

+    while b:

+        a = a + 3

+    a = a + 5

+    write(stdout, "Hallo!")

+

+

+# We should come till here :-)

+discard Foo(345)