tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
This commit is contained in:
parent
ac9c1cd6b9
commit
e80465dacf
372 changed files with 4486 additions and 4486 deletions
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue