renamed writeln to writeLine in tests

This commit is contained in:
patrick dw 2015-06-19 01:34:34 -05:00
commit 69e15ac32f
39 changed files with 456 additions and 456 deletions

View file

@ -12,7 +12,7 @@ type
proc len(x: TMyType): int {.inline.} = return x.len
proc x(s: TMyType, len: int) =
writeln(stdout, len(s))
writeLine(stdout, len(s))
var
m: TMyType

View file

@ -10,6 +10,6 @@ import mambsym1, times
var
v = mDec #ERROR_MSG ambiguous identifier
writeln(stdout, ord(v))
writeLine(stdout, ord(v))

View file

@ -22,10 +22,10 @@ proc test() =
b = a # perform a deep copy here!
b.seq = @["xyz", "huch", "was", "soll"]
writeln(stdout, len(a.seq))
writeln(stdout, a.seq[3])
writeln(stdout, len(b.seq))
writeln(stdout, b.seq[3])
writeln(stdout, b.y)
writeLine(stdout, len(a.seq))
writeLine(stdout, a.seq[3])
writeLine(stdout, len(b.seq))
writeLine(stdout, b.seq[3])
writeLine(stdout, b.y)
test()

View file

@ -16,8 +16,8 @@ proc main() =
p = find(example, "=")
a = substr(example, 0, p-1)
b = substr(example, p+1)
writeln(stdout, a & '=' & b)
#writeln(stdout, b)
writeLine(stdout, a & '=' & b)
#writeLine(stdout, b)
main()
#OUT TEMP=C:\Programs\xyz\bin

View file

@ -13,7 +13,7 @@ type
proc forw: int {. .}
proc lier(): int {.raises: [IO2Error].} =
writeln stdout, "arg"
writeLine stdout, "arg"
proc forw: int =
raise newException(IOError, "arg")

View file

@ -13,7 +13,7 @@ type
proc forw: int {.raises: [].}
proc lier(): int {.raises: [IOError].} =
writeln stdout, "arg"
writeLine stdout, "arg"
proc forw: int =
raise newException(IOError, "arg")

View file

@ -12,7 +12,7 @@ type
EIO2 = ref object of EIO
proc raiser(): int {.tags: [TObj, FWriteIO].} =
writeln stdout, "arg"
writeLine stdout, "arg"
var o: TObjB
o.fn = raiser

View file

@ -15,7 +15,7 @@ proc q() {.tags: [FIO].} =
nil
proc raiser(): int =
writeln stdout, "arg"
writeLine stdout, "arg"
if true:
q()

View file

@ -63,12 +63,12 @@ proc caseTree(lvl: int = 0): PCaseNode =
if lvl == 3: result = newCaseNode("data item")
else: result = newCaseNode(caseTree(lvl+1), caseTree(lvl+1))
proc finalizeBNode(n: TBNode) = writeln(stdout, n.data)
proc finalizeBNode(n: TBNode) = writeLine(stdout, n.data)
proc finalizeNode(n: PNode) =
assert(n != nil)
write(stdout, "finalizing: ")
if isNil(n.data): writeln(stdout, "nil!")
else: writeln(stdout, n.data)
if isNil(n.data): writeLine(stdout, "nil!")
else: writeLine(stdout, n.data)
var
id: int = 1
@ -82,7 +82,7 @@ proc buildTree(depth = 1): PNode =
inc(id)
proc returnTree(): PNode =
writeln(stdout, "creating id: " & $id)
writeLine(stdout, "creating id: " & $id)
new(result, finalizeNode)
result.data = $id
new(result.le, finalizeNode)
@ -92,26 +92,26 @@ proc returnTree(): PNode =
inc(id)
# now create a cycle:
writeln(stdout, "creating id (cyclic): " & $id)
writeLine(stdout, "creating id (cyclic): " & $id)
var cycle: PNode
new(cycle, finalizeNode)
cycle.data = $id
cycle.le = cycle
cycle.ri = cycle
inc(id)
#writeln(stdout, "refcount: " & $refcount(cycle))
#writeln(stdout, "refcount le: " & $refcount(cycle.le))
#writeln(stdout, "refcount ri: " & $refcount(cycle.ri))
#writeLine(stdout, "refcount: " & $refcount(cycle))
#writeLine(stdout, "refcount le: " & $refcount(cycle.le))
#writeLine(stdout, "refcount ri: " & $refcount(cycle.ri))
proc printTree(t: PNode) =
if t == nil: return
writeln(stdout, "printing")
writeln(stdout, t.data)
writeLine(stdout, "printing")
writeLine(stdout, t.data)
printTree(t.le)
printTree(t.ri)
proc unsureNew(result: var PNode) =
writeln(stdout, "creating unsure id: " & $id)
writeLine(stdout, "creating unsure id: " & $id)
new(result, finalizeNode)
result.data = $id
new(result.le, finalizeNode)
@ -176,7 +176,7 @@ proc main() =
var s: seq[string] = @[]
for i in 1..100:
add s, "hohoho" # test reallocation
writeln(stdout, s[89])
writeLine(stdout, s[89])
write(stdout, "done!\n")
var
@ -184,7 +184,7 @@ var
s: string
s = ""
s = ""
writeln(stdout, repr(caseTree()))
writeLine(stdout, repr(caseTree()))
father.t.data = @["ha", "lets", "stress", "it"]
father.t.data = @["ha", "lets", "stress", "it"]
var t = buildTree()
@ -199,5 +199,5 @@ GC_fullCollect()
# the M&S GC fails with this call and it's unclear why. Definitely something
# we need to fix!
GC_fullCollect()
writeln(stdout, GC_getStatistics())
writeLine(stdout, GC_getStatistics())
write(stdout, "finished\n")

View file

@ -15,7 +15,7 @@ if find(root, "world"):
for str in items(root):
stdout.write(str)
else:
stdout.writeln("BUG")
stdout.writeLine("BUG")
var
r2: PBinaryTree[int]

View file

@ -92,7 +92,7 @@ when isMainModule:
for str in items(root):
stdout.write(str)
else:
stdout.writeln("BUG")
stdout.writeLine("BUG")
var
r2: PBinaryTree[int]

View file

@ -184,7 +184,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
proc traceln(space: string) =
writeln stdout, ""
writeLine stdout, ""
write stdout, space
proc doTrace(n: PNode[T,D], level: int) =
@ -192,7 +192,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
traceln(space)
write stdout, "node: "
if n == nil:
writeln stdout, "is empty"
writeLine stdout, "is empty"
return
write stdout, n.count
write stdout, " elements: "
@ -219,7 +219,7 @@ proc traceTree[T,D](root: PNode[T,D]) =
else : write stdout, el.key
if el.node != nil: doTrace(el.node, level +1)
else : write stdout, " empty "
writeln stdout,""
writeLine stdout,""
doTrace(root, 0)

View file

@ -50,8 +50,8 @@ proc main*(infile: string, a, b: int, someverylongnamewithtype = 0,
# this should be an error!
if initBaseLexer(L, infile, 30): nil
else:
writeln(stdout, "could not open: " & infile)
writeln(stdout, "Success!")
writeLine(stdout, "could not open: " & infile)
writeLine(stdout, "Success!")
call(3, # we use 3
12, # we use 12
43) # we use 43

View file

@ -18,7 +18,7 @@ macro debug(n: varargs[expr]): stmt =
# add a call to the statement list that writes ": "
add(result, newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
# add a call to the statement list that writes the expressions value:
add(result, newCall("writeln", newIdentNode("stdout"), n[i]))
add(result, newCall("writeLine", newIdentNode("stdout"), n[i]))
var
a: array [0..10, int]

View file

@ -7,8 +7,8 @@ var
i: int
params = paramCount()
i = 0
writeln(stdout, "This exe: " & getAppFilename())
writeln(stdout, "Number of parameters: " & $params)
writeLine(stdout, "This exe: " & getAppFilename())
writeLine(stdout, "Number of parameters: " & $params)
while i <= params:
writeln(stdout, paramStr(i))
writeLine(stdout, paramStr(i))
i = i + 1

View file

@ -1,3 +1,3 @@
# test the new endian magic
writeln(stdout, repr(system.cpuEndian))
writeLine(stdout, repr(system.cpuEndian))

View file

@ -22,7 +22,7 @@ macro macrotest(n: expr): stmt {.immediate.} =
result = newNimNode(nnkStmtList, n)
for i in 2..n.len-1:
result.add(newCall("write", n[1], n[i]))
result.add(newCall("writeln", n[1], newStrLitNode("")))
result.add(newCall("writeLine", n[1], newStrLitNode("")))
macro debug(n: expr): stmt {.immediate.} =
let n = callsite()
@ -30,7 +30,7 @@ macro debug(n: expr): stmt {.immediate.} =
for i in 1..n.len-1:
result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i])))
result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
result.add(newCall("writeln", newIdentNode("stdout"), n[i]))
result.add(newCall("writeLine", newIdentNode("stdout"), n[i]))
macrotest(stdout, "finally", 4, 5, "variable", "argument lists")
macrotest(stdout)
@ -38,7 +38,7 @@ macrotest(stdout)
#GC_disable()
echo("This was compiled by Nim version " & system.NimVersion)
writeln(stdout, "Hello", " World", "!")
writeLine(stdout, "Hello", " World", "!")
echo(["a", "b", "c", "d"].len)
for x in items(["What's", "your", "name", "?", ]):

View file

@ -8,8 +8,8 @@ proc main() =
a, b: TTime
a = getLastModificationTime(paramStr(1))
b = getLastModificationTime(paramStr(2))
writeln(stdout, $a)
writeln(stdout, $b)
writeLine(stdout, $a)
writeLine(stdout, $b)
if a < b:
write(stdout, "$2 is newer than $1\n" % [paramStr(1), paramStr(2)])
else:

View file

@ -24,10 +24,10 @@ var size = parseInt (paramStr (1))
var bit = 128
var byteAcc = 0
stdout.writeln ("P4")
stdout.writeLine ("P4")
stdout.write ($size)
stdout.write (" ")
stdout.writeln ($size)
stdout.writeLine ($size)
var fsize = float (size)
for y in 0 .. size-1:

View file

@ -9,4 +9,4 @@ var
x = 1
y = high(int)
writeln(stdout, $ ( x +% y ) )
writeLine(stdout, $ ( x +% y ) )

View file

@ -91,9 +91,9 @@ proc t64(i: int64) =
toVarNum64(i, b)
var x = toNum64(b)
if x != i:
writeln(stdout, $i)
writeln(stdout, toBinary(i))
writeln(stdout, toBinary(x))
writeLine(stdout, $i)
writeLine(stdout, toBinary(i))
writeLine(stdout, toBinary(x))
proc t32(i: int32) =
var
@ -101,8 +101,8 @@ proc t32(i: int32) =
toVarNum(i, b)
var x = toNum(b)
if x != i:
writeln(stdout, toBinary(i))
writeln(stdout, toBinary(x))
writeLine(stdout, toBinary(i))
writeLine(stdout, toBinary(x))
proc tm(i: int32) =
var
@ -110,8 +110,8 @@ proc tm(i: int32) =
toVarNum64(i, b)
var x = toNum(b)
if x != i:
writeln(stdout, toBinary(i))
writeln(stdout, toBinary(x))
writeLine(stdout, toBinary(i))
writeLine(stdout, toBinary(x))
t32(0)
t32(1)
@ -137,6 +137,6 @@ tm(100_000)
tm(low(int32))
tm(high(int32))
writeln(stdout, "Success!") #OUT Success!
writeLine(stdout, "Success!") #OUT Success!

View file

@ -9,7 +9,7 @@ type
proc getPoint( p: var TPoint2d) =
{.breakpoint.}
writeln(stdout, p.x)
writeLine(stdout, p.x)
var
p: TPoint3d

View file

@ -16,7 +16,7 @@ type
TCircle = object of TFigure
radius: int
proc drawCircle(my: var TCircle) = stdout.writeln("o " & $my.radius)
proc drawCircle(my: var TCircle) = stdout.writeLine("o " & $my.radius)
proc init(my: var TCircle) =
init(TFigure(my)) # call base constructor

View file

@ -11,9 +11,9 @@ var
a = high(int)
b = -2
try:
writeln(stdout, b - a)
writeLine(stdout, b - a)
except OverflowError:
writeln(stdout, "the computation overflowed")
writeLine(stdout, "the computation overflowed")
{.pop.} # overflow check
#OUT the computation overflowed

View file

@ -58,7 +58,7 @@ for x in low(TAZ) .. high(TAZ):
for x in low(TTokTypeRange) .. high(TTokTypeRange):
if x in tokTypes:
discard
#writeln(stdout, "the token '$1' is in the set" % repr(x))
#writeLine(stdout, "the token '$1' is in the set" % repr(x))
#OUT Ha ein F ist in s!

View file

@ -2,6 +2,6 @@
proc main() =
for line in lines("thello.nim"):
writeln(stdout, line)
writeLine(stdout, line)
main()

View file

@ -4,10 +4,10 @@ import
parseopt
proc writeHelp() =
writeln(stdout, "Usage: tparsopt [options] filename [options]")
writeLine(stdout, "Usage: tparsopt [options] filename [options]")
proc writeVersion() =
writeln(stdout, "Version: 1.0.0")
writeLine(stdout, "Version: 1.0.0")
var
filename = ""
@ -20,7 +20,7 @@ for kind, key, val in getopt():
of "help", "h": writeHelp()
of "version", "v": writeVersion()
else:
writeln(stdout, "Unknown command line option: ", key, ": ", val)
writeLine(stdout, "Unknown command line option: ", key, ": ", val)
of cmdEnd: assert(false) # cannot happen
if filename == "":
# no filename has been given, so we show the help:

View file

@ -981,7 +981,7 @@ iterator split*(s: string, sep: TPeg): string =
##
## .. code-block:: nim
## for word in split("00232this02939is39an22example111", peg"\d+"):
## writeln(stdout, word)
## writeLine(stdout, word)
##
## Results in:
##
@ -1682,7 +1682,7 @@ when isMainModule:
doAssert "ABC".match(peg"\d+ / \w+")
for word in split("00232this02939is39an22example111", peg"\d+"):
writeln(stdout, word)
writeLine(stdout, word)
doAssert matchLen("key", ident) == 3

View file

@ -9,8 +9,8 @@ when not defined(windows):
discard uname(u)
writeln(stdout, u.sysname)
writeln(stdout, u.nodename)
writeln(stdout, u.release)
writeln(stdout, u.machine)
writeLine(stdout, u.sysname)
writeLine(stdout, u.nodename)
writeLine(stdout, u.release)
writeLine(stdout, u.machine)

View file

@ -9,7 +9,7 @@ type
var val = {a, b}
stdout.write(repr(val))
stdout.writeln(repr({'a'..'z', 'A'..'Z'}))
stdout.writeLine(repr({'a'..'z', 'A'..'Z'}))
type
TObj {.pure, inheritable.} = object

View file

@ -26,7 +26,7 @@ q[] = p
s = @[q, q, q, q]
writeln(stdout, repr(p))
writeln(stdout, repr(q))
writeln(stdout, repr(s))
writeln(stdout, repr(en4))
writeLine(stdout, repr(p))
writeLine(stdout, repr(q))
writeLine(stdout, repr(s))
writeLine(stdout, repr(en4))

View file

@ -6,7 +6,7 @@ for i in 0..80:
tab["key_" & $i] = "value" & $i
for key, val in pairs(tab):
writeln(stdout, key, ": ", val)
writeln(stdout, "length of table ", $tab.len)
writeLine(stdout, key, ": ", val)
writeLine(stdout, "length of table ", $tab.len)
writeln(stdout, `%`("$key1 = $key2; ${PATH}", tab, {useEnvironment}))
writeLine(stdout, `%`("$key1 = $key2; ${PATH}", tab, {useEnvironment}))

View file

@ -5,9 +5,9 @@ import
proc main(filter: string) =
for filename in walkFiles(filter):
writeln(stdout, filename)
writeLine(stdout, filename)
for key, val in envPairs():
writeln(stdout, key & '=' & val)
writeLine(stdout, key & '=' & val)
main("*.nim")

View file

@ -15,10 +15,10 @@ var abclev = levB
template tstLev(abclev: TLev) =
bind tstempl.abclev, `%`
writeln(stdout, "global = $1, arg = $2, test = $3" % [
writeLine(stdout, "global = $1, arg = $2, test = $3" % [
$tstempl.abclev, $abclev, $(tstempl.abclev == abclev)])
# evaluates to true, but must be false
tstLev(levA)
writeln(stdout, $abclev)
writeLine(stdout, $abclev)

View file

@ -13,8 +13,8 @@ template withOpenFile(f: expr, filename: string, mode: TFileMode,
quit("cannot open for writing: " & filename)
withOpenFile(txt, "ttempl3.txt", fmWrite):
writeln(txt, "line 1")
txt.writeln("line 2")
writeLine(txt, "line 1")
txt.writeLine("line 2")
var
myVar: array[0..1, int]

View file

@ -137,11 +137,11 @@ proc doScenario(script: string, output: Stream, mode: TRunMode, verbose: bool):
if line.strip.len == 0: continue
if line.startsWith("#"):
output.writeln line
output.writeLine line
continue
elif line.startsWith(">"):
s.doCommand(line.substr(1).strip)
output.writeln line, "\n", if verbose: s.lastOutput else: ""
output.writeLine line, "\n", if verbose: s.lastOutput else: ""
else:
var expectMatch = true
var pattern = s.replaceVars(line)
@ -153,9 +153,9 @@ proc doScenario(script: string, output: Stream, mode: TRunMode, verbose: bool):
s.lastOutput.find(re(pattern, flags = {reStudy})) != -1
if expectMatch == actualMatch:
output.writeln "SUCCESS ", line
output.writeLine "SUCCESS ", line
else:
output.writeln "FAILURE ", line
output.writeLine "FAILURE ", line
result = false
iterator caasTestsRunner*(filter = "", verbose = false): tuple[test,

View file

@ -138,7 +138,7 @@ proc generateHtml*(filename: string, commit: int; onlyFailing: bool) =
# generate navigation:
outfile.write("""<ul id="tabs">""")
for m in db.rows(sql"select id, name, os, cpu from Machine order by id"):
outfile.writeln """<li><a href="#$#">$#: $#, $#</a></li>""" % m
outfile.writeLine """<li><a href="#$#">$#: $#, $#</a></li>""" % m
outfile.write("</ul>")
for currentMachine in db.rows(sql"select id from Machine order by id"):
@ -195,7 +195,7 @@ proc generateJson*(filename: string, commit: int) =
let machine = $backend.getMachine(db)
let data = db.getRow(sql(selRow), lastCommit, machine)
outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#""" % data)
outfile.writeLine("""{"total": $#, "passed": $#, "skipped": $#""" % data)
let results = newJArray()
for row in db.rows(sql(selResults), lastCommit):
@ -208,7 +208,7 @@ proc generateJson*(filename: string, commit: int) =
obj["expected"] = %row[5]
obj["given"] = %row[6]
results.add(obj)
outfile.writeln(""", "results": """)
outfile.writeLine(""", "results": """)
outfile.write(results.pretty)
if not previousCommit.isNil:
@ -220,9 +220,9 @@ proc generateJson*(filename: string, commit: int) =
obj["old"] = %row[1]
obj["new"] = %row[2]
diff.add obj
outfile.writeln(""", "diff": """)
outfile.writeln(diff.pretty)
outfile.writeLine(""", "diff": """)
outfile.writeLine(diff.pretty)
outfile.writeln "}"
outfile.writeLine "}"
close(db)
close(outfile)

View file

@ -4,6 +4,6 @@ discard """
proc f(x: varargs[string, `$`]) = discard
template optF{f(x)}(x: varargs[expr]) =
writeln(stdout, x)
writeLine(stdout, x)
f 1, 2, false, 3, "ha"

View file

@ -7,13 +7,13 @@ discard """
template optWrite{
write(f, x)
((write|writeln){w})(f, y)
((write|writeLine){w})(f, y)
}(x, y: varargs[expr], f, w: expr) =
w(f, "|", x, y, "|")
if true:
echo "0"
write stdout, "1"
writeln stdout, "2"
writeLine stdout, "2"
write stdout, "3"
echo "4"