summary refs log tree commit diff stats
path: root/tests/iter/titer.nim
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2015-09-04 23:04:32 +0200
committerAdam Strzelecki <ono@java.pl>2015-09-04 23:04:32 +0200
commite80465dacf50f260abec30ae57d37b298c93fd83 (patch)
tree393394f8353a4adb49f95e6f13da1fd41681b7b3 /tests/iter/titer.nim
parentac9c1cd6b980d4f00eeb52d1109d8e2c8cd21213 (diff)
downloadNim-e80465dacf50f260abec30ae57d37b298c93fd83.tar.gz
tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
Diffstat (limited to 'tests/iter/titer.nim')
-rw-r--r--tests/iter/titer.nim88
1 files changed, 44 insertions, 44 deletions
diff --git a/tests/iter/titer.nim b/tests/iter/titer.nim
index 19a11dc4e..c4143ae4f 100644
--- a/tests/iter/titer.nim
+++ b/tests/iter/titer.nim
@@ -1,44 +1,44 @@
-# Test the new iterators

-

-iterator xrange(fromm, to: int, step = 1): int =

-  var a = fromm

-  while a <= to:

-    yield a

-    inc(a, step)

-

-iterator interval[T](a, b: T): T =

-  var x = a

-  while x <= b:

-    yield x

-    inc(x)

-

-#

-#iterator lines(filename: string): (line: string) =

-#  var

-#    f: tTextfile

-#    shouldClose = open(f, filename)

-#  if shouldClose:

-#    setSpace(line, 256)

-#    while readTextLine(f, line):

-#      yield line

-#  finally:

-#    if shouldClose: close(f)

-#

-

-for i in xrange(0, 5):

-  for k in xrange(1, 7):

-    write(stdout, "test")

-

-for j in interval(45, 45):

-  write(stdout, "test2!")

-  write(stdout, "test3?")

-

-for x in items(["hi", "what's", "your", "name"]):

-  echo(x)

-  

-const

-  stringArray = ["hi", "what's", "your", "name"]

-

-for i in 0..len(stringArray)-1:

-  echo(stringArray[i])

-

+# Test the new iterators
+
+iterator xrange(fromm, to: int, step = 1): int =
+  var a = fromm
+  while a <= to:
+    yield a
+    inc(a, step)
+
+iterator interval[T](a, b: T): T =
+  var x = a
+  while x <= b:
+    yield x
+    inc(x)
+
+#
+#iterator lines(filename: string): (line: string) =
+#  var
+#    f: tTextfile
+#    shouldClose = open(f, filename)
+#  if shouldClose:
+#    setSpace(line, 256)
+#    while readTextLine(f, line):
+#      yield line
+#  finally:
+#    if shouldClose: close(f)
+#
+
+for i in xrange(0, 5):
+  for k in xrange(1, 7):
+    write(stdout, "test")
+
+for j in interval(45, 45):
+  write(stdout, "test2!")
+  write(stdout, "test3?")
+
+for x in items(["hi", "what's", "your", "name"]):
+  echo(x)
+
+const
+  stringArray = ["hi", "what's", "your", "name"]
+
+for i in 0..len(stringArray)-1:
+  echo(stringArray[i])
+