tests: Trim .nim files trailing whitespace

via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
This commit is contained in:
Adam Strzelecki 2015-09-04 23:04:32 +02:00
commit e80465dacf
372 changed files with 4486 additions and 4486 deletions

View file

@ -1,10 +1,10 @@
proc `*` *(a, b: seq[int]): seq[int] =
proc `*` *(a, b: seq[int]): seq[int] =
# allocate a new sequence:
newSeq(result, len(a))
# multiply two int sequences:
for i in 0..len(a)-1: result[i] = a[i] * b[i]
when isMainModule:
when isMainModule:
# test the new ``*`` operator for sequences:
assert(@[1, 2, 3] * @[1, 2, 3] == @[1, 4, 9])

View file

@ -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?

View file

@ -6,7 +6,7 @@ discard """
type
TMsg = tuple[
file: string,
line: int,
line: int,
msg: string,
err: bool]

View file

@ -4,9 +4,9 @@ discard """
import sequtils
for x in toSeq(countup(2, 6)):
for x in toSeq(countup(2, 6)):
stdout.write(x)
for x in items(toSeq(countup(2, 6))):
for x in items(toSeq(countup(2, 6))):
stdout.write(x)
import strutils