summary refs log tree commit diff stats
path: root/tests/seq/tseqcon.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/seq/tseqcon.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/seq/tseqcon.nim')
-rw-r--r--tests/seq/tseqcon.nim90
1 files changed, 45 insertions, 45 deletions
diff --git a/tests/seq/tseqcon.nim b/tests/seq/tseqcon.nim
index 6e0a5b56d..902ac3485 100644
--- a/tests/seq/tseqcon.nim
+++ b/tests/seq/tseqcon.nim
@@ -2,50 +2,50 @@ discard """
   file: "tseqcon.nim"
   output: "Hithere, what\'s your name?Hathere, what\'s your name?"
 """
-# Test the add proc for sequences and strings

-

-const

-  nestedFixed = true

-

-type

-  TRec {.final.} = object

-    x, y: int

-    s: string

-    seq: seq[string]

-  TRecSeq = seq[TRec]

-

-proc test() =

-  var s, b: seq[string]

-  s = @[]

-  add(s, "Hi")

-  add(s, "there, ")

-  add(s, "what's your name?")

-

-  b = s # deep copying here!

-  b[0][1] = 'a'

-

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

-    write(stdout, s[i])

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

-    write(stdout, b[i])

-

-

-when nestedFixed:

-  proc nested() =

-    var

-      s: seq[seq[string]]

-    for i in 0..10_000: # test if the garbage collector

-      # now works with sequences

-      s = @[

-        @["A", "B", "C", "D"],

-        @["E", "F", "G", "H"],

-        @["I", "J", "K", "L"],

-        @["M", "N", "O", "P"]]

-

-test()

-when nestedFixed:

-  nested()

-

-#OUT Hithere, what's your name?Hathere, what's your name?

+# Test the add proc for sequences and strings
+
+const
+  nestedFixed = true
+
+type
+  TRec {.final.} = object
+    x, y: int
+    s: string
+    seq: seq[string]
+  TRecSeq = seq[TRec]
+
+proc test() =
+  var s, b: seq[string]
+  s = @[]
+  add(s, "Hi")
+  add(s, "there, ")
+  add(s, "what's your name?")
+
+  b = s # deep copying here!
+  b[0][1] = 'a'
+
+  for i in 0 .. len(s)-1:
+    write(stdout, s[i])
+  for i in 0 .. len(b)-1:
+    write(stdout, b[i])
+
+
+when nestedFixed:
+  proc nested() =
+    var
+      s: seq[seq[string]]
+    for i in 0..10_000: # test if the garbage collector
+      # now works with sequences
+      s = @[
+        @["A", "B", "C", "D"],
+        @["E", "F", "G", "H"],
+        @["I", "J", "K", "L"],
+        @["M", "N", "O", "P"]]
+
+test()
+when nestedFixed:
+  nested()
+
+#OUT Hithere, what's your name?Hathere, what's your name?