summary refs log tree commit diff stats
path: root/tests/iter
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
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')
-rw-r--r--tests/iter/tcountup.nim6
-rw-r--r--tests/iter/titer.nim88
-rw-r--r--tests/iter/titer6.nim8
-rw-r--r--tests/iter/titer8.nim4
-rw-r--r--tests/iter/titer_no_tuple_unpack.nim14
5 files changed, 60 insertions, 60 deletions
diff --git a/tests/iter/tcountup.nim b/tests/iter/tcountup.nim
index e68a614b0..1559041aa 100644
--- a/tests/iter/tcountup.nim
+++ b/tests/iter/tcountup.nim
@@ -3,11 +3,11 @@ discard """
   output: "0123456789"
 """
 
-# Test new countup and unary < 
+# Test new countup and unary <
 
-for i in 0 .. < 10'i64: 
+for i in 0 .. < 10'i64:
   stdout.write(i)
-  
+
 #OUT 0123456789
 
 
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])
+
diff --git a/tests/iter/titer6.nim b/tests/iter/titer6.nim
index 2abfa0860..b7c8fee80 100644
--- a/tests/iter/titer6.nim
+++ b/tests/iter/titer6.nim
@@ -22,16 +22,16 @@ iterator tokenize2(s: string, seps: set[char] = Whitespace): tuple[
     i = j
 
 for word, isSep in tokenize2("ta da", WhiteSpace):
-  var titer2TestVar = 0 
+  var titer2TestVar = 0
   stdout.write(titer2TestVar)
 
-proc wordWrap2(s: string, maxLineWidth = 80, 
+proc wordWrap2(s: string, maxLineWidth = 80,
                splitLongWords = true,
                seps: set[char] = Whitespace,
-               newLine = "\n"): string  = 
+               newLine = "\n"): string  =
   result = ""
   for word, isSep in tokenize2(s, seps):
-    var w = 0 
+    var w = 0
 
 
 
diff --git a/tests/iter/titer8.nim b/tests/iter/titer8.nim
index 3bc01122f..7b6d7b6de 100644
--- a/tests/iter/titer8.nim
+++ b/tests/iter/titer8.nim
@@ -55,7 +55,7 @@ echo ""
 proc inProc() =
   for c in count3():
     echo c
-  
+
   for word, isSep in tokenize2("ta da", WhiteSpace):
     stdout.write(word)
 
@@ -69,7 +69,7 @@ inProc()
 iterator count0(): int {.closure.} =
   # note: doesn't require anything in its closure (except 'state')
   yield 0
- 
+
 iterator count2(): int {.closure.} =
   # note: requires 'x' in its closure
   var x = 1
diff --git a/tests/iter/titer_no_tuple_unpack.nim b/tests/iter/titer_no_tuple_unpack.nim
index da5e1bc46..13ec11bd6 100644
--- a/tests/iter/titer_no_tuple_unpack.nim
+++ b/tests/iter/titer_no_tuple_unpack.nim
@@ -1,13 +1,13 @@
-

-iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] =

-  var a = fromm

-  while a <= to:

-    yield (a, a+1)

-    inc(a, step)

+
+iterator xrange(fromm, to: int, step = 1): tuple[x, y: int] =
+  var a = fromm
+  while a <= to:
+    yield (a, a+1)
+    inc(a, step)
 
 for a, b in xrange(3, 7):
   echo a, " ", b
-  
+
 for tup in xrange(3, 7):
   echo tup