diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim
index ae151ff942..67644e1561 100755
--- a/lib/pure/parsecfg.nim
+++ b/lib/pure/parsecfg.nim
@@ -74,15 +74,18 @@ const
proc rawGetTok(c: var TCfgParser, tok: var TToken)
-proc open*(c: var TCfgParser, input: PStream, filename: string) {.
+proc open*(c: var TCfgParser, input: PStream, filename: string,
+ lineOffset = 0) {.
rtl, extern: "npc$1".} =
## initializes the parser with an input stream. `Filename` is only used
- ## for nice error messages.
+ ## for nice error messages. `lineOffset` can be used to influence the line
+ ## number information in the generated error messages.
lexbase.open(c, input)
c.filename = filename
c.state = startState
c.tok.kind = tkInvalid
c.tok.literal = ""
+ inc(c.linenumber, lineOffset)
rawGetTok(c, c.tok)
proc close*(c: var TCfgParser) {.rtl, extern: "npc$1".} =
@@ -291,6 +294,23 @@ proc errorStr*(c: TCfgParser, msg: string): string {.rtl, extern: "npc$1".} =
## column information.
result = `%`("$1($2, $3) Error: $4",
[c.filename, $getLine(c), $getColumn(c), msg])
+
+proc warningStr*(c: TCfgParser, msg: string): string {.rtl, extern: "npc$1".} =
+ ## returns a properly formated warning message containing current line and
+ ## column information.
+ result = `%`("$1($2, $3) Warning: $4",
+ [c.filename, $getLine(c), $getColumn(c), msg])
+
+proc ignoreMsg*(c: TCfgParser, e: TCfgEvent): string {.rtl, extern: "npc$1".} =
+ ## returns a properly formated warning message containing that
+ ## an entry is ignored.
+ case e.kind
+ of cfgSectionStart: result = c.warningStr("section ignored: " & e.section)
+ of cfgKeyValuePair: result = c.warningStr("key ignored: " & e.key)
+ of cfgOption:
+ result = c.warningStr("command ignored: " & e.key & ": " & e.value)
+ of cfgError: result = e.msg
+ of cfgEof: result = ""
proc getKeyValPair(c: var TCfgParser, kind: TCfgEventKind): TCfgEvent =
if c.tok.kind == tkSymbol:
diff --git a/lib/pure/ropes.nim b/lib/pure/ropes.nim
index 14a01044f6..52406d4d1c 100755
--- a/lib/pure/ropes.nim
+++ b/lib/pure/ropes.nim
@@ -271,7 +271,6 @@ when false:
j = j * 10 + ord(frmt[i]) - ord('0')
inc(i)
if frmt[i] notin {'0'..'9'}: break
- num = j
add(s, compiledArg(j))
of '{':
inc(i)
@@ -281,7 +280,6 @@ when false:
inc(i)
if frmt[i] == '}': inc(i)
else: raise newException(EInvalidValue, "invalid format string")
- num = j
add(s, compiledArg(j))
else: raise newException(EInvalidValue, "invalid format string")
var start = i
@@ -316,7 +314,6 @@ proc `%`*(frmt: string, args: openarray[PRope]): PRope {.
j = j * 10 + ord(frmt[i]) - ord('0')
inc(i)
if frmt[i] notin {'0'..'9'}: break
- num = j
add(result, args[j-1])
of '{':
inc(i)
@@ -326,7 +323,6 @@ proc `%`*(frmt: string, args: openarray[PRope]): PRope {.
inc(i)
if frmt[i] == '}': inc(i)
else: raise newException(EInvalidValue, "invalid format string")
- num = j
add(result, args[j-1])
else: raise newException(EInvalidValue, "invalid format string")
var start = i
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim
index d7b4572633..8d59666705 100755
--- a/lib/pure/strutils.nim
+++ b/lib/pure/strutils.nim
@@ -139,7 +139,7 @@ proc findNormalized(x: string, inArray: openarray[string]): int =
var i = 0
while i < high(inArray):
if cmpIgnoreStyle(x, inArray[i]) == 0: return i
- inc(i, 2) # incrementing by 1 would probably result in a
+ inc(i, 2) # incrementing by 1 would probably lead to a
# security hole...
return -1
@@ -166,7 +166,6 @@ proc addf*(s: var string, formatstr: string, a: openarray[string]) {.
while formatstr[i] in Digits:
j = j * 10 + ord(formatstr[i]) - ord('0')
inc(i)
- num = j
add s, a[j - 1]
of '{':
var j = i+1
@@ -1003,5 +1002,6 @@ when isMainModule:
it goes""", 10, false)
assert formatBiggestFloat(0.00000000001, ffDecimal, 11) == "0.00000000001"
assert formatBiggestFloat(0.00000000001, ffScientific, 1) == "1.0e-11"
-
+
+ assert "$# $3 $# $#" % ["a", "b", "c"] == "a c b c"
diff --git a/rod/msgs.nim b/rod/msgs.nim
index 69e260d415..00ec619415 100755
--- a/rod/msgs.nim
+++ b/rod/msgs.nim
@@ -364,8 +364,8 @@ type
TLineInfo*{.final.} = object # This is designed to be as small as possible,
# because it is used
# in syntax nodes. We safe space here by using
- # two int16 and an int32
- # on 64 bit and on 32 bit systems this is
+ # two int16 and an int32.
+ # On 64 bit and on 32 bit systems this is
# only 8 bytes.
line*, col*: int16
fileIndex*: int32
@@ -454,10 +454,8 @@ proc getMessageStr(msg: TMsgKind, arg: string): string =
result = `%`(msgKindToString(msg), [arg])
proc inCheckpoint*(current: TLineInfo): bool =
- ## prints the line information if in checkpoint
- result = false
for i in countup(0, high(checkPoints)):
- if (current.line == checkPoints[i].line) and
+ if (current.line >= checkPoints[i].line) and
(current.fileIndex == (checkPoints[i].fileIndex)):
return true
diff --git a/rod/nimrod.ini b/rod/nimrod.ini
index d4c6dc3b28..4560814449 100755
--- a/rod/nimrod.ini
+++ b/rod/nimrod.ini
@@ -3,7 +3,7 @@ Name: "Nimrod"
Version: "$version"
; Windows and i386 must be first!
OS: "windows;linux;macosx;freebsd;netbsd;openbsd;solaris"
-CPU: "i386;amd64;powerpc" # ;sparc
+CPU: "i386;amd64;powerpc64" # ;sparc
Authors: "Andreas Rumpf"
Description: """This is the Nimrod Compiler. Nimrod is a new statically typed,
imperative programming language, that supports procedural, functional, object
diff --git a/rod/platform.nim b/rod/platform.nim
index 4e2240a90d..422cc61342 100755
--- a/rod/platform.nim
+++ b/rod/platform.nim
@@ -143,8 +143,9 @@ const
type
TSystemCPU* = enum # Also add CPU for in initialization section and
# alias conditionals to condsyms (end of module).
- cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuSparc, cpuVm, cpuIa64,
- cpuAmd64, cpuMips, cpuArm, cpuEcmaScript, cpuNimrodVM
+ cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuPowerpc64,
+ cpuSparc, cpuVm, cpuIa64, cpuAmd64, cpuMips, cpuArm,
+ cpuEcmaScript, cpuNimrodVM
type
TEndian* = enum
@@ -158,7 +159,8 @@ const
(name: "i386", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
(name: "m68k", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
(name: "alpha", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
- (name: "powerpc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
+ (name: "powerpc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
+ (name: "powerpc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
(name: "sparc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
(name: "vm", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
(name: "ia64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
diff --git a/rod/suggest.nim b/rod/suggest.nim
index 55c072218b..377c988bdf 100644
--- a/rod/suggest.nim
+++ b/rod/suggest.nim
@@ -9,7 +9,7 @@
## This file implements features required for IDE support.
-import ast, astalgo, semdata, msgs, types
+import scanner, ast, astalgo, semdata, msgs, types
const
sep = '\t'
@@ -33,12 +33,16 @@ proc SymToStr(s: PSym, isLocal: bool): string =
result.add(sep)
result.add($ToColumn(s.info))
+proc suggestSym(s: PSym): bool {.inline.} =
+ result = s.name.s[0] in scanner.SymChars
+
proc suggestExpr*(c: PContext, n: PNode) =
if not msgs.inCheckpoint(n.info): return
for i in countdown(c.tab.tos-1, 0):
for it in items(c.tab.stack[i]):
- MessageOut(SymToStr(it, i > ModuleTablePos))
+ if suggestSym(it):
+ MessageOut(SymToStr(it, i > ModuleTablePos))
quit(0)
proc suggestStmt*(c: PContext, n: PNode) =
diff --git a/tests/accept/run/spec.csv b/tests/accept/run/spec.csv
deleted file mode 100755
index 5102c85b17..0000000000
--- a/tests/accept/run/spec.csv
+++ /dev/null
@@ -1,89 +0,0 @@
-tack.nim;125
-tambsym2.nim;7
-tambsys.nim;
-tarray.nim;10012
-tarraycons.nim;6
-tarray2.nim;[16, 25, 36]
-tarray3.nim;3
-tassert.nim;assertion failure!this shall be always written
-tbind1.nim;3
-tbind3.nim;1
-tbintre2.nim;helloworld99110223
-tbintree.nim;helloworld99110223
-tbug499771.nim;TSubRange: 5 from 1 to 10
-tbug511622.nim;3
-tcasestm.nim;ayyy
-tcgbug.nim;
-tclosure.nim;2 4 6 8 10
-tcnstseq.nim;AngelikaAnneAnnaAnkaAnja
-tconstr2.nim;69
-tcontinuexc.nim;ECcaught
-tcopy.nim;TEMP=C:\Programs\xyz\bin
-tcountup.nim;0123456789
-tcurrncy.nim;25
-temit.nim;509
-tenumhole.nim;my value A1my value Bconc2valueCabc4abc
-texcsub.nim;caught!
-texplicitgeneric1.nim;Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13
-tfinally.nim;came here 3
-tfinally2.nim;ABCD
-tfinally3.nim;false
-tfloat1.nim;Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
-tfloat2.nim;Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
-tfloat3.nim;Nimrod 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698
-tformat.nim;Hi Andreas! How do you feel, Rumpf?
-thintoff.nim;0
-tinit.nim;Hello from module! Hello from main module!
-tints.nim;Success
-tisopr.nim;falsetrue
-titer2.nim;123
-titer3.nim;1231
-titer5.nim;abcxyz
-titer6.nim;000
-tlenopenarray.nim;1
-tlowhigh.nim;10
-tmatrix.nim;111
-tmultim1.nim;7
-tmultim2.nim;collide: unit, thing collide: unit, thing collide: thing, unit
-tmultim3.nim;Hi derived!
-tmultim4.nim;hello
-tnamedenumfields.nim;my value A0my value Bconc1valueCabc3abc
-tnestif.nim;i == 2
-tnestprc.nim;10
-toop1.nim;34[]o 5
-topenarrayrepr.nim;5 - [1]
-topenlen.nim;7
-toprprec.nim;done
-toverflw.nim;the computation overflowed
-toverflw2.nim;Error: unhandled exception: over- or underflow [EOverflow]
-toverl2.nim;true012
-toverlop.nim;3
-toverwr.nim;hello
-tovfint.nim;works!
-tpos.nim;6
-tprintf.nim;Andreas Rumpf
-tprocvar.nim;papbpcpdpe7
-tquotewords.nim;thisanexample
-tregex.nim;key: keyAYes!
-treguse.nim;055this should be the casehugh
-treraise.nim;Error: unhandled exception: bla [ESomeOtherErr]
-tromans.nim;success
-tseqcon.nim;Hithere, what's your name?Hathere, what's your name?
-tseqtuple.nim;fA13msg1falsefB14msg2truefC15msg3false
-tsets.nim;Ha ein F ist in s!
-tsidee2.nim;5
-tsidee3.nim;5
-tsimmeth.nim;HELLO WORLD!
-tsplit.nim;true
-tstrange.nim;hallo4
-tstrlits.nim;a""long string"""""abc"def
-tstrutil.nim;ha/home/a1xyz/usr/bin
-tvardecl.nim;44
-tvariantasgn.nim;came here
-tvariantstack.nim;came here
-tvarnums.nim;Success!
-tvartup.nim;2 3
-tunhandledexc.nim;Error: unhandled exception: bla [ESomeOtherErr]
-twrongexc.nim;Error: unhandled exception [EInvalidValue]
-txmlgen.nim;
-txmltree.nim;true
diff --git a/tests/accept/run/tack.nim b/tests/accept/run/tack.nim
index 59535e5479..680ff567e7 100755
--- a/tests/accept/run/tack.nim
+++ b/tests/accept/run/tack.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tack.nim"
+ output: "125"
+"""
# the Ackermann function
proc ack(x, y: int): int =
@@ -13,3 +17,5 @@ proc ack(x, y: int): int =
# echo(ack(0, 0))
write(stdout, ack(3, 4)) #OUT 125
+
+
diff --git a/tests/accept/run/tambsym2.nim b/tests/accept/run/tambsym2.nim
index 9178182aaa..745427c546 100755
--- a/tests/accept/run/tambsym2.nim
+++ b/tests/accept/run/tambsym2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tambsym2.nim"
+ output: "7"
+"""
# Test overloading of procs with locals
type
@@ -16,3 +20,5 @@ m.len = 7
m.data = "1234"
x(m, 5) #OUT 7
+
+
diff --git a/tests/accept/run/tambsys.nim b/tests/accept/run/tambsys.nim
index bb2622824f..a886158666 100755
--- a/tests/accept/run/tambsys.nim
+++ b/tests/accept/run/tambsys.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tambsys.nim"
+ output: ""
+"""
# Test ambiguous symbols
import mambsys1, mambsys2
@@ -5,3 +9,5 @@ import mambsys1, mambsys2
var
v: mambsys1.TExport
mambsys2.foo(3) #OUT
+
+
diff --git a/tests/accept/run/tarray.nim b/tests/accept/run/tarray.nim
index 252cbd991b..16ef558d1f 100755
--- a/tests/accept/run/tarray.nim
+++ b/tests/accept/run/tarray.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tarray.nim"
+ output: "10012"
+"""
# simple check for one dimensional arrays
type
@@ -25,3 +29,5 @@ write(stdout, sum([1, 2, 3, 4]))
write(stdout, sum([]))
write(stdout, getPos( (x: 5, y: 7) ))
#OUT 10012
+
+
diff --git a/tests/accept/run/tarray2.nim b/tests/accept/run/tarray2.nim
index eb0b756924..048f51795c 100755
--- a/tests/accept/run/tarray2.nim
+++ b/tests/accept/run/tarray2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tarray2.nim"
+ output: "[16, 25, 36]"
+"""
# simple check for one dimensional arrays
type
@@ -16,3 +20,5 @@ y = x
echo repr(mul(x, y))
#OUT [16, 25, 36]
+
+
diff --git a/tests/accept/run/tarray3.nim b/tests/accept/run/tarray3.nim
index 881bb7ba4d..d287783574 100755
--- a/tests/accept/run/tarray3.nim
+++ b/tests/accept/run/tarray3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tarray3.nim"
+ output: "3"
+"""
# simple check for two dimensional arrays
const
@@ -5,3 +9,5 @@ const
echo myData[0][2] #OUT 3
+
+
diff --git a/tests/accept/run/tarraycons.nim b/tests/accept/run/tarraycons.nim
index 12f13ac339..0b2a42c2f3 100755
--- a/tests/accept/run/tarraycons.nim
+++ b/tests/accept/run/tarraycons.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tarraycons.nim"
+ output: "6"
+"""
type
TEnum = enum
@@ -15,3 +19,5 @@ const
echo myMapping[eC][1]
+
+
diff --git a/tests/accept/run/tassert.nim b/tests/accept/run/tassert.nim
index 9fd18e9bdf..e32ee0a84f 100755
--- a/tests/accept/run/tassert.nim
+++ b/tests/accept/run/tassert.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tassert.nim"
+ output: "assertion failure!this shall be always written"
+"""
# test assert and exception handling
proc callB() = assert(False)
@@ -14,3 +18,5 @@ finally:
system.write(stdout, "this shall be always written")
assert(false) #OUT assertion failure!this shall be always written
+
+
diff --git a/tests/accept/run/tbind1.nim b/tests/accept/run/tbind1.nim
index e7eed3e4f8..536a67f917 100755
--- a/tests/accept/run/tbind1.nim
+++ b/tests/accept/run/tbind1.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tbind1.nim"
+ output: "3"
+"""
# Test the new ``bind`` keyword for templates
proc p1(x: int8, y: int): int = return x + y
@@ -12,3 +16,5 @@ proc p1(x: int, y: int8): int = return x - y
echo tempBind(1'i8, 2'i8) #OUT 3
+
+
diff --git a/tests/accept/run/tbind3.nim b/tests/accept/run/tbind3.nim
index f7fb4865b1..551acc10f5 100755
--- a/tests/accept/run/tbind3.nim
+++ b/tests/accept/run/tbind3.nim
@@ -1,5 +1,11 @@
+discard """
+ file: "tbind3.nim"
+ output: "1"
+"""
# Module B
import mbind3
echo genId() #OUT 1
+
+
diff --git a/tests/accept/run/tbintre2.nim b/tests/accept/run/tbintre2.nim
index e85837dfa9..2a72254115 100755
--- a/tests/accept/run/tbintre2.nim
+++ b/tests/accept/run/tbintre2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tbintre2.nim"
+ output: "helloworld99110223"
+"""
# Same test, but check module boundaries
import tbintree
@@ -23,3 +27,5 @@ for y in items(r2):
#OUT helloworld99110223
+
+
diff --git a/tests/accept/run/tbintree.nim b/tests/accept/run/tbintree.nim
index 0561e004ab..8cc8acb820 100755
--- a/tests/accept/run/tbintree.nim
+++ b/tests/accept/run/tbintree.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tbintree.nim"
+ output: "helloworld99110223"
+"""
type
TBinaryTree[T] = object # TBinaryTree is a generic type with
# with generic param ``T``
@@ -99,3 +103,5 @@ when isMainModule:
stdout.write(y)
#OUT helloworld99110223
+
+
diff --git a/tests/accept/run/tbug499771.nim b/tests/accept/run/tbug499771.nim
index 1b141adac0..633ab39f6c 100755
--- a/tests/accept/run/tbug499771.nim
+++ b/tests/accept/run/tbug499771.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "tbug499771.nim"
+ output: "TSubRange: 5 from 1 to 10"
+"""
type TSubRange = range[1 .. 10]
var sr: TSubRange = 5
echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " &
$high(TSubRange))
+
+
diff --git a/tests/accept/run/tbug511622.nim b/tests/accept/run/tbug511622.nim
index c0a2555f4f..a5360423dc 100755
--- a/tests/accept/run/tbug511622.nim
+++ b/tests/accept/run/tbug511622.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tbug511622.nim"
+ output: "3"
+"""
import StrUtils, Math
proc FibonacciA(n: int): int64 =
@@ -8,3 +12,5 @@ proc FibonacciA(n: int): int64 =
echo FibonacciA(4) #OUT 3
+
+
diff --git a/tests/accept/run/tcasestm.nim b/tests/accept/run/tcasestm.nim
index 277b0bab1d..cb63e0c51e 100755
--- a/tests/accept/run/tcasestm.nim
+++ b/tests/accept/run/tcasestm.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcasestm.nim"
+ output: "ayyy"
+"""
# Test the case statement
type
@@ -30,3 +34,5 @@ else:
#OUT ayyy
+
+
diff --git a/tests/accept/run/tcgbug.nim b/tests/accept/run/tcgbug.nim
index 320821fb61..aa0f0fa6bb 100755
--- a/tests/accept/run/tcgbug.nim
+++ b/tests/accept/run/tcgbug.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcgbug.nim"
+ output: ""
+"""
type
TObj = object
@@ -15,3 +19,5 @@ var
new(a)
q(a)
+
+
diff --git a/tests/accept/run/tclosure.nim b/tests/accept/run/tclosure.nim
index 761e9a8f30..28a51e1acf 100755
--- a/tests/accept/run/tclosure.nim
+++ b/tests/accept/run/tclosure.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tclosure.nim"
+ output: "2 4 6 8 10"
+"""
# Test the closure implementation
proc map(n: var openarray[int], fn: proc (x: int): int {.closure}) =
@@ -24,3 +28,5 @@ for x in items(myData):
#OUT 2 4 6 8 10
+
+
diff --git a/tests/accept/run/tcnstseq.nim b/tests/accept/run/tcnstseq.nim
index 4f389bb3b6..e7d2333b4a 100755
--- a/tests/accept/run/tcnstseq.nim
+++ b/tests/accept/run/tcnstseq.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcnstseq.nim"
+ output: "AngelikaAnneAnnaAnkaAnja"
+"""
# Test the new implicit conversion from sequences to arrays in a constant
# context.
@@ -9,3 +13,5 @@ const
for x in items(myWords):
write(stdout, x) #OUT AngelikaAnneAnnaAnkaAnja
+
+
diff --git a/tests/accept/run/tconstr2.nim b/tests/accept/run/tconstr2.nim
index 7687a416ca..30cec5cb87 100755
--- a/tests/accept/run/tconstr2.nim
+++ b/tests/accept/run/tconstr2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tconstr2.nim"
+ output: "69"
+"""
# Test array, record constructors
type
@@ -18,3 +22,5 @@ const
write(stdout, things[0].x)
#OUT 69
+
+
diff --git a/tests/accept/run/tcontinuexc.nim b/tests/accept/run/tcontinuexc.nim
index 496ee81644..c43e68c93a 100755
--- a/tests/accept/run/tcontinuexc.nim
+++ b/tests/accept/run/tcontinuexc.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcontinuexc.nim"
+ output: "ECcaught"
+"""
type
ESomething = object of E_Base
ESomeOtherErr = object of E_Base
@@ -21,3 +25,5 @@ finally:
#OUT ECcaught
+
+
diff --git a/tests/accept/run/tcopy.nim b/tests/accept/run/tcopy.nim
index 6cb2ec14cb..3c7ccae4b8 100755
--- a/tests/accept/run/tcopy.nim
+++ b/tests/accept/run/tcopy.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcopy.nim"
+ output: "TEMP=C:\\Programs\\xyz\\bin"
+"""
# tests the copy proc
import
@@ -17,3 +21,5 @@ proc main() =
main()
#OUT TEMP=C:\Programs\xyz\bin
+
+
diff --git a/tests/accept/run/tcountup.nim b/tests/accept/run/tcountup.nim
index 4d4c9b304d..e68a614b0d 100755
--- a/tests/accept/run/tcountup.nim
+++ b/tests/accept/run/tcountup.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcountup.nim"
+ output: "0123456789"
+"""
# Test new countup and unary <
@@ -6,3 +10,5 @@ for i in 0 .. < 10'i64:
#OUT 0123456789
+
+
diff --git a/tests/accept/run/tcurrncy.nim b/tests/accept/run/tcurrncy.nim
index fa08d620b8..a614de7afe 100755
--- a/tests/accept/run/tcurrncy.nim
+++ b/tests/accept/run/tcurrncy.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tcurrncy.nim"
+ output: "25"
+"""
template Additive(typ: typeDesc): stmt =
proc `+` *(x, y: typ): typ {.borrow.}
proc `-` *(x, y: typ): typ {.borrow.}
@@ -30,3 +34,5 @@ DefineCurrency(TDollar, int)
DefineCurrency(TEuro, int)
echo($( 12.TDollar + 13.TDollar )) #OUT 25
+
+
diff --git a/tests/accept/run/temit.nim b/tests/accept/run/temit.nim
index 81f9b53ae1..cb7d513bd6 100755
--- a/tests/accept/run/temit.nim
+++ b/tests/accept/run/temit.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "temit.nim"
+ output: "509"
+"""
# Test the new ``emit`` pragma:
{.emit: """
@@ -12,3 +16,5 @@ proc embedsC() {.pure.} =
embedsC()
+
+
diff --git a/tests/accept/run/tenumhole.nim b/tests/accept/run/tenumhole.nim
index 75fb745926..b721c73dd5 100755
--- a/tests/accept/run/tenumhole.nim
+++ b/tests/accept/run/tenumhole.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tenumhole.nim"
+ output: "my value A1my value Bconc2valueCabc4abc"
+"""
const
strValB = "my value B"
@@ -14,3 +18,5 @@ var x = valueD
echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
+
+
diff --git a/tests/accept/run/texcsub.nim b/tests/accept/run/texcsub.nim
index b35f0fa3fe..3dba357f9d 100755
--- a/tests/accept/run/texcsub.nim
+++ b/tests/accept/run/texcsub.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "texcsub.nim"
+ output: "caught!"
+"""
# Test inheritance for exception matching:
try:
@@ -9,3 +13,5 @@ except:
#OUT caught!
+
+
diff --git a/tests/accept/run/texplicitgeneric1.nim b/tests/accept/run/texplicitgeneric1.nim
index 54fff52463..6cca71ac08 100755
--- a/tests/accept/run/texplicitgeneric1.nim
+++ b/tests/accept/run/texplicitgeneric1.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "texplicitgeneric1.nim"
+ output: "Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13"
+"""
# test explicit type instantiation
type
@@ -30,3 +34,5 @@ c.add('B', "13")
for k, v in items(c):
stdout.write(" Key: ", $k, " value: ", v)
+
+
diff --git a/tests/accept/run/texplicitgeneric2.nim b/tests/accept/run/texplicitgeneric2.nim
index 9bd2f04c88..f2e6282234 100755
--- a/tests/accept/run/texplicitgeneric2.nim
+++ b/tests/accept/run/texplicitgeneric2.nim
@@ -1,3 +1,7 @@
+discard """
+ output: "Key: 12 value: 12Key: 13 value: 13 Key: A value: 12 Key: B value: 13"
+"""
+
# test explicit type instantiation
type
diff --git a/tests/accept/run/tfinally.nim b/tests/accept/run/tfinally.nim
index 92c1e500fc..29313c3fdf 100755
--- a/tests/accept/run/tfinally.nim
+++ b/tests/accept/run/tfinally.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfinally.nim"
+ output: "came here 3"
+"""
# Test return in try statement:
proc main: int =
@@ -13,3 +17,5 @@ proc main: int =
echo main() #OUT came here 3
+
+
diff --git a/tests/accept/run/tfinally2.nim b/tests/accept/run/tfinally2.nim
index 10d08e816b..3ed212a7c7 100755
--- a/tests/accept/run/tfinally2.nim
+++ b/tests/accept/run/tfinally2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfinally2.nim"
+ output: "ABCD"
+"""
# Test break in try statement:
proc main: int =
@@ -19,3 +23,5 @@ proc main: int =
discard main() #OUT ABCD
+
+
diff --git a/tests/accept/run/tfinally3.nim b/tests/accept/run/tfinally3.nim
index e8d81c8934..e65661cd02 100755
--- a/tests/accept/run/tfinally3.nim
+++ b/tests/accept/run/tfinally3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfinally3.nim"
+ output: "false"
+"""
# Test break in try statement:
proc main: bool =
@@ -10,3 +14,5 @@ proc main: bool =
echo main() #OUT false
+
+
diff --git a/tests/accept/run/tfloat1.nim b/tests/accept/run/tfloat1.nim
index 89911dd614..3826bf1f56 100755
--- a/tests/accept/run/tfloat1.nim
+++ b/tests/accept/run/tfloat1.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfloat1.nim"
+ output: "Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]"
+"""
# Test new floating point exceptions
{.floatChecks: on.}
@@ -6,3 +10,5 @@ var x = 0.8
var y = 0.0
echo x / y #OUT Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
+
+
diff --git a/tests/accept/run/tfloat2.nim b/tests/accept/run/tfloat2.nim
index 92421d4462..e7a9ce76f9 100755
--- a/tests/accept/run/tfloat2.nim
+++ b/tests/accept/run/tfloat2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfloat2.nim"
+ output: "Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]"
+"""
# Test new floating point exceptions
{.floatChecks: on.}
@@ -6,3 +10,5 @@ var x = 0.0
var y = 0.0
echo x / y #OUT Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
+
+
diff --git a/tests/accept/run/tfloat3.nim b/tests/accept/run/tfloat3.nim
index 72acce9587..4382dd3eda 100755
--- a/tests/accept/run/tfloat3.nim
+++ b/tests/accept/run/tfloat3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tfloat3.nim"
+ output: "Nimrod 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
+"""
import math, strutils
@@ -16,3 +20,5 @@ var x: float = 1.234567890123456789
c_printf("Nimrod %.10f, %.10f ", exp(x), cos(x))
printFloats()
+
+
diff --git a/tests/accept/run/tformat.nim b/tests/accept/run/tformat.nim
index aba35504bf..92c0c16f50 100755
--- a/tests/accept/run/tformat.nim
+++ b/tests/accept/run/tformat.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "tformat.nim"
+ output: "Hi Andreas! How do you feel, Rumpf?"
+"""
# Tests the new format proc (including the & and &= operators)
import strutils
echo("Hi $1! How do you feel, $2?\n" % ["Andreas", "Rumpf"])
#OUT Hi Andreas! How do you feel, Rumpf?
+
+
diff --git a/tests/accept/run/thintoff.nim b/tests/accept/run/thintoff.nim
index 7aff283d65..807ff44f38 100755
--- a/tests/accept/run/thintoff.nim
+++ b/tests/accept/run/thintoff.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "thintoff.nim"
+ output: "0"
+"""
{.hint[XDeclaredButNotUsed]: off.}
var
x: int
echo x #OUT 0
+
+
diff --git a/tests/accept/run/tinit.nim b/tests/accept/run/tinit.nim
index 386bfec37f..5c75567ece 100755
--- a/tests/accept/run/tinit.nim
+++ b/tests/accept/run/tinit.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "tinit.nim"
+ output: "Hello from module! Hello from main module!"
+"""
# Test the new init section in modules
import minit
write(stdout, "Hello from main module!\n")
#OUT Hello from module! Hello from main module!
+
+
diff --git a/tests/accept/run/tints.nim b/tests/accept/run/tints.nim
index f2b52c1349..6c98978609 100755
--- a/tests/accept/run/tints.nim
+++ b/tests/accept/run/tints.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tints.nim"
+ output: "Success"
+"""
# Test the different integer operations
var testNumber = 0
@@ -39,3 +43,5 @@ test(`shl`, 0xffffffff'i32, 0x4'i32, 0xfffffff0'i32)
Echo("Success") #OUT Success
+
+
diff --git a/tests/accept/run/tisopr.nim b/tests/accept/run/tisopr.nim
index d52859b09f..7e7a8f650f 100755
--- a/tests/accept/run/tisopr.nim
+++ b/tests/accept/run/tisopr.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tisopr.nim"
+ output: "falsetrue"
+"""
# Test is operator
type
@@ -18,3 +22,5 @@ write(stdout, p(m))
write(stdout, p(n))
#OUT falsetrue
+
+
diff --git a/tests/accept/run/titer2.nim b/tests/accept/run/titer2.nim
index b9cdb53fe8..1e70ce2473 100755
--- a/tests/accept/run/titer2.nim
+++ b/tests/accept/run/titer2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "titer2.nim"
+ output: "123"
+"""
# Try to break the transformation pass:
iterator iterAndZero(a: var openArray[int]): int =
for i in 0..len(a)-1:
@@ -8,3 +12,5 @@ var x = [[1, 2, 3], [4, 5, 6]]
for y in iterAndZero(x[0]): write(stdout, $y)
#OUT 123
+
+
diff --git a/tests/accept/run/titer3.nim b/tests/accept/run/titer3.nim
index d0e1214458..ab95dd7bdb 100755
--- a/tests/accept/run/titer3.nim
+++ b/tests/accept/run/titer3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "titer3.nim"
+ output: "1231"
+"""
iterator count1_3: int =
yield 1
@@ -14,4 +18,5 @@ iterator iter1(a: openArray[int]): int =
var x = [[1, 2, 3], [4, 5, 6]]
for y in iter1(x[0]): write(stdout, $y)
-#OUT 1231
\ No newline at end of file
+#OUT 1231
+
diff --git a/tests/accept/run/titer5.nim b/tests/accept/run/titer5.nim
index 1ac37ba66c..bbd50fcb1e 100755
--- a/tests/accept/run/titer5.nim
+++ b/tests/accept/run/titer5.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "titer5.nim"
+ output: "abcxyz"
+"""
# Test method call syntax for iterators:
import strutils
@@ -8,3 +12,5 @@ for x in lines.split():
#OUT abcxyz
+
+
diff --git a/tests/accept/run/titer6.nim b/tests/accept/run/titer6.nim
index 8a1d9cf1b5..fa58e9a6cd 100755
--- a/tests/accept/run/titer6.nim
+++ b/tests/accept/run/titer6.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "titer6.nim"
+ output: "000"
+"""
# Test iterator with more than 1 yield statement
import strutils
@@ -29,3 +33,5 @@ proc wordWrap2(s: string, maxLineWidth = 80,
for word, isSep in tokenize2(s, seps):
var w = 0
+
+
diff --git a/tests/accept/run/tlenopenarray.nim b/tests/accept/run/tlenopenarray.nim
index 9731cb4f2c..58041def25 100755
--- a/tests/accept/run/tlenopenarray.nim
+++ b/tests/accept/run/tlenopenarray.nim
@@ -1,5 +1,11 @@
+discard """
+ file: "tlenopenarray.nim"
+ output: "1"
+"""
# len(x) --> len([x]) --> match!
echo len(1_000_000) #OUT 1
+
+
diff --git a/tests/accept/run/tlowhigh.nim b/tests/accept/run/tlowhigh.nim
index 79f5c5b95d..d1cbd32726 100755
--- a/tests/accept/run/tlowhigh.nim
+++ b/tests/accept/run/tlowhigh.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tlowhigh.nim"
+ output: "10"
+"""
# Test the magic low() and high() procs
type
@@ -16,3 +20,5 @@ proc sum(a: openarray[int]): int =
write(stdout, sum([1, 2, 3, 4]))
#OUT 10
+
+
diff --git a/tests/accept/run/tmatrix.nim b/tests/accept/run/tmatrix.nim
index a162d0f109..1dd09291bf 100755
--- a/tests/accept/run/tmatrix.nim
+++ b/tests/accept/run/tmatrix.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tmatrix.nim"
+ output: "111"
+"""
# Test overloading of [] with multiple indices
type
@@ -58,3 +62,5 @@ for i in 0..w-1:
for i in 0..w-1:
stdout.write(m[i,i]) #OUT 111
+
+
diff --git a/tests/accept/run/tmultim1.nim b/tests/accept/run/tmultim1.nim
index 5d807e4c92..542c846c78 100755
--- a/tests/accept/run/tmultim1.nim
+++ b/tests/accept/run/tmultim1.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tmultim1.nim"
+ output: "7"
+"""
# Test multi methods
type
@@ -21,3 +25,5 @@ proc newPlus(a, b: ref TExpr): ref TPlusExpr =
result.b = b
echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4))) #OUT 7
+
+
diff --git a/tests/accept/run/tmultim2.nim b/tests/accept/run/tmultim2.nim
index c43c9b6f06..956b226470 100755
--- a/tests/accept/run/tmultim2.nim
+++ b/tests/accept/run/tmultim2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tmultim2.nim"
+ output: "collide: unit, thing collide: unit, thing collide: thing, unit"
+"""
# Test multi methods
type
@@ -28,3 +32,5 @@ collide(a, b)
#OUT collide: unit, thing collide: unit, thing collide: thing, unit
+
+
diff --git a/tests/accept/run/tmultim3.nim b/tests/accept/run/tmultim3.nim
index a3271d8d96..373c84c0ec 100755
--- a/tests/accept/run/tmultim3.nim
+++ b/tests/accept/run/tmultim3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tmultim3.nim"
+ output: "Hi derived!"
+"""
import mmultim3
type
@@ -12,3 +16,5 @@ new(a)
myObj = a
testMyObj()
+
+
diff --git a/tests/accept/run/tmultim4.nim b/tests/accept/run/tmultim4.nim
index fbfaf31751..6bb7970dd8 100755
--- a/tests/accept/run/tmultim4.nim
+++ b/tests/accept/run/tmultim4.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tmultim4.nim"
+ output: "hello"
+"""
type
Test = object of TObject
@@ -37,3 +41,5 @@ for z in 1..4:
# break
+
+
diff --git a/tests/accept/run/tnamedenumfields.nim b/tests/accept/run/tnamedenumfields.nim
index 6012cf1eb9..e9ac88a42c 100755
--- a/tests/accept/run/tnamedenumfields.nim
+++ b/tests/accept/run/tnamedenumfields.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tnamedenumfields.nim"
+ output: "my value A0my value Bconc1valueCabc3abc"
+"""
const
strValB = "my value B"
@@ -15,3 +19,5 @@ var x = valueD
echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x
+
+
diff --git a/tests/accept/run/tnestif.nim b/tests/accept/run/tnestif.nim
index 558fe8d078..bfcd8751c4 100755
--- a/tests/accept/run/tnestif.nim
+++ b/tests/accept/run/tnestif.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tnestif.nim"
+ output: "i == 2"
+"""
# test nested ifs
var
@@ -16,3 +20,5 @@ elif x == 2:
else:
write(stdout, "looks like Python")
#OUT i == 2
+
+
diff --git a/tests/accept/run/tnestprc.nim b/tests/accept/run/tnestprc.nim
index b7326e0323..c10ad6abf5 100755
--- a/tests/accept/run/tnestprc.nim
+++ b/tests/accept/run/tnestprc.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tnestprc.nim"
+ output: "10"
+"""
# Test nested procs without closures
proc Add3(x: int): int =
@@ -8,3 +12,5 @@ proc Add3(x: int): int =
echo Add3(7) #OUT 10
+
+
diff --git a/tests/accept/run/toop1.nim b/tests/accept/run/toop1.nim
index 8bae002e7a..a925642e81 100755
--- a/tests/accept/run/toop1.nim
+++ b/tests/accept/run/toop1.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toop1.nim"
+ output: "34[]o 5"
+"""
# Test the stuff in the tutorial
import macros
@@ -80,3 +84,5 @@ c!draw()
#OUT 34[]o 5
+
+
diff --git a/tests/accept/run/topenarrayrepr.nim b/tests/accept/run/topenarrayrepr.nim
index 7e976540f1..ec7be722a1 100755
--- a/tests/accept/run/topenarrayrepr.nim
+++ b/tests/accept/run/topenarrayrepr.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "topenarrayrepr.nim"
+ output: "5 - [1]"
+"""
type
TProc = proc (n: int, m: openarray[int64])
@@ -9,3 +13,5 @@ proc Bar(n: int, m: openarray[int64]) =
Foo(5, Bar) #OUT 5 - [1]
+
+
diff --git a/tests/accept/run/topenlen.nim b/tests/accept/run/topenlen.nim
index b9d7fbc2de..fec8e87b7b 100755
--- a/tests/accept/run/topenlen.nim
+++ b/tests/accept/run/topenlen.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "topenlen.nim"
+ output: "7"
+"""
# Tests a special bug
proc choose(b: openArray[string]): string = return b[0]
@@ -10,3 +14,5 @@ proc p(a, b: openarray[string]): int =
discard choose(["sh", "-c", $p([""], ["a"])])
echo($p(["", "ha", "abc"], ["xyz"])) #OUT 7
+
+
diff --git a/tests/accept/run/toprprec.nim b/tests/accept/run/toprprec.nim
index 4728b2e68b..17ec91fdac 100755
--- a/tests/accept/run/toprprec.nim
+++ b/tests/accept/run/toprprec.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toprprec.nim"
+ output: "done"
+"""
# Test operator precedence:
assert 3+5*5-2 == 28- -26-28
@@ -10,3 +14,5 @@ assert 34 ^- 6 ^- 2 == 30
assert 34 - 6 - 2 == 26
echo "done"
+
+
diff --git a/tests/accept/run/toverflw.nim b/tests/accept/run/toverflw.nim
index 3dadcf13ba..cd7b65acfb 100755
--- a/tests/accept/run/toverflw.nim
+++ b/tests/accept/run/toverflw.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toverflw.nim"
+ output: "the computation overflowed"
+"""
# Tests nimrod's ability to detect overflows
{.push overflowChecks: on.}
@@ -13,3 +17,5 @@ except EOverflow:
{.pop.} # overflow check
#OUT the computation overflowed
+
+
diff --git a/tests/accept/run/toverflw2.nim b/tests/accept/run/toverflw2.nim
index b54bda9fa2..14a77ebad3 100755
--- a/tests/accept/run/toverflw2.nim
+++ b/tests/accept/run/toverflw2.nim
@@ -1,5 +1,11 @@
+discard """
+ file: "toverflw2.nim"
+ output: "Error: unhandled exception: over- or underflow [EOverflow]"
+"""
var a : int32 = 2147483647
var b : int32 = 2147483647
var c = a + b
+
+
diff --git a/tests/accept/run/toverl2.nim b/tests/accept/run/toverl2.nim
index 2d1225c6f3..49b17da4df 100755
--- a/tests/accept/run/toverl2.nim
+++ b/tests/accept/run/toverl2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toverl2.nim"
+ output: "true012"
+"""
# Test new overloading resolution rules
import strutils
@@ -19,3 +23,5 @@ for x in toverl2(3):
stdout.write("\n")
#OUT true012
+
+
diff --git a/tests/accept/run/toverlop.nim b/tests/accept/run/toverlop.nim
index f11275644b..ce302345f7 100755
--- a/tests/accept/run/toverlop.nim
+++ b/tests/accept/run/toverlop.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toverlop.nim"
+ output: "3"
+"""
# Test operator overloading
proc `%` (a, b: int): int =
@@ -8,3 +12,5 @@ x = 15
y = 6
write(stdout, x % y)
#OUT 3
+
+
diff --git a/tests/accept/run/toverwr.nim b/tests/accept/run/toverwr.nim
index 6705c6b3f0..ef25e89139 100755
--- a/tests/accept/run/toverwr.nim
+++ b/tests/accept/run/toverwr.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "toverwr.nim"
+ output: "hello"
+"""
# Test the overloading resolution in connection with a qualifier
proc write(t: TFile, s: string) =
@@ -5,3 +9,5 @@ proc write(t: TFile, s: string) =
system.write(stdout, "hello")
#OUT hello
+
+
diff --git a/tests/accept/run/tovfint.nim b/tests/accept/run/tovfint.nim
index 91eda8d0b8..cfb1e649d8 100755
--- a/tests/accept/run/tovfint.nim
+++ b/tests/accept/run/tovfint.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tovfint.nim"
+ output: "works!"
+"""
# this tests the new overflow literals
var
@@ -15,3 +19,5 @@ else:
write(stdout, "broken!\n")
#OUT works!
+
+
diff --git a/tests/accept/run/tpos.nim b/tests/accept/run/tpos.nim
index df701d3c53..3d72536dd5 100755
--- a/tests/accept/run/tpos.nim
+++ b/tests/accept/run/tpos.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tpos.nim"
+ output: "6"
+"""
# test this particular function
proc mypos(sub, s: string, start: int = 0): int =
@@ -27,3 +31,5 @@ var sub = "hello"
var s = "world hello"
write(stdout, mypos(sub, s))
#OUT 6
+
+
diff --git a/tests/accept/run/tprintf.nim b/tests/accept/run/tprintf.nim
index 14687a9379..c8fb51cdc7 100755
--- a/tests/accept/run/tprintf.nim
+++ b/tests/accept/run/tprintf.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tprintf.nim"
+ output: "Andreas Rumpf"
+"""
# Test a printf proc
proc printf(file: TFile, args: openarray[string]) =
@@ -8,3 +12,5 @@ proc printf(file: TFile, args: openarray[string]) =
printf(stdout, ["Andreas ", "Rumpf\n"])
#OUT Andreas Rumpf
+
+
diff --git a/tests/accept/run/tprocvar.nim b/tests/accept/run/tprocvar.nim
index f51543dfa8..237e2ef7a8 100755
--- a/tests/accept/run/tprocvar.nim
+++ b/tests/accept/run/tprocvar.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tprocvar.nim"
+ output: "papbpcpdpe7"
+"""
# test variables of type proc
proc pa() {.cdecl.} = write(stdout, "pa")
@@ -24,3 +28,5 @@ discard x(3, 4)
#OUT papbpcpdpe7
+
+
diff --git a/tests/accept/run/tquotewords.nim b/tests/accept/run/tquotewords.nim
index 462293b404..81f30c9a9a 100755
--- a/tests/accept/run/tquotewords.nim
+++ b/tests/accept/run/tquotewords.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tquotewords.nim"
+ output: "thisanexample"
+"""
# Test an idea I recently had:
import macros
@@ -17,3 +21,5 @@ for w in items(myWordList):
echo s #OUT thisanexample
+
+
diff --git a/tests/accept/run/tregex.nim b/tests/accept/run/tregex.nim
index 882f981321..7ac628c4dd 100755
--- a/tests/accept/run/tregex.nim
+++ b/tests/accept/run/tregex.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tregex.nim"
+ output: "key: keyAYes!"
+"""
# Test the new regular expression module
# which is based on the PCRE library
@@ -18,3 +22,5 @@ else:
echo("Bug!")
#OUT key: keyAYes!
+
+
diff --git a/tests/accept/run/treguse.nim b/tests/accept/run/treguse.nim
index dc805fc703..a610ad7258 100755
--- a/tests/accept/run/treguse.nim
+++ b/tests/accept/run/treguse.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "treguse.nim"
+ output: "055this should be the casehugh"
+"""
# Test the register usage of the virtual machine and
# the blocks in var statements
@@ -19,3 +23,5 @@ proc main(a, b: int) =
main(45, 1000)
#OUT 055this should be the casehugh
+
+
diff --git a/tests/accept/run/treraise.nim b/tests/accept/run/treraise.nim
index 18f2b5f54b..7e147c3367 100755
--- a/tests/accept/run/treraise.nim
+++ b/tests/accept/run/treraise.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "treraise.nim"
+ output: "Error: unhandled exception: bla [ESomeOtherErr]"
+"""
type
ESomething = object of E_Base
ESomeOtherErr = object of E_Base
@@ -15,3 +19,5 @@ except ESomething:
except:
raise
+
+
diff --git a/tests/accept/run/tromans.nim b/tests/accept/run/tromans.nim
index 12deca1eaa..fa6a63595f 100755
--- a/tests/accept/run/tromans.nim
+++ b/tests/accept/run/tromans.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tromans.nim"
+ output: "success"
+"""
import
strutils
@@ -63,3 +67,5 @@ for i in items([1238, 1777, 3830, 2401, 379, 33, 940, 3973]):
echo "success" #OUT success
+
+
diff --git a/tests/accept/run/tseqcon.nim b/tests/accept/run/tseqcon.nim
index 935da86b55..6e0a5b56d1 100755
--- a/tests/accept/run/tseqcon.nim
+++ b/tests/accept/run/tseqcon.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tseqcon.nim"
+ output: "Hithere, what\'s your name?Hathere, what\'s your name?"
+"""
# Test the add proc for sequences and strings
const
@@ -43,3 +47,5 @@ when nestedFixed:
nested()
#OUT Hithere, what's your name?Hathere, what's your name?
+
+
diff --git a/tests/accept/run/tseqtuple.nim b/tests/accept/run/tseqtuple.nim
index 975521c56e..7ef92f7f13 100755
--- a/tests/accept/run/tseqtuple.nim
+++ b/tests/accept/run/tseqtuple.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tseqtuple.nim"
+ output: "fA13msg1falsefB14msg2truefC15msg3false"
+"""
type
TMsg = tuple[
@@ -20,3 +24,5 @@ for file, line, msg, err in items(s):
#OUT fA13msg1falsefB14msg2truefC15msg3false
+
+
diff --git a/tests/accept/run/tsets.nim b/tests/accept/run/tsets.nim
index 08ab3e54be..7b806f15b9 100755
--- a/tests/accept/run/tsets.nim
+++ b/tests/accept/run/tsets.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tsets.nim"
+ output: "Ha ein F ist in s!"
+"""
# Test the handling of sets
import
@@ -56,3 +60,5 @@ for x in low(TTokTypeRange) .. high(TTokTypeRange):
#writeln(stdout, "the token '$1' is in the set" % repr(x))
#OUT Ha ein F ist in s!
+
+
diff --git a/tests/accept/run/tsidee2.nim b/tests/accept/run/tsidee2.nim
index 2eaec01d75..e73c896080 100755
--- a/tests/accept/run/tsidee2.nim
+++ b/tests/accept/run/tsidee2.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tsidee2.nim"
+ output: "5"
+"""
var
global: int
@@ -9,3 +13,5 @@ proc SideEffectLyer(x, y: int): int {.noSideEffect.} =
echo SideEffectLyer(1, 3) #OUT 5
+
+
diff --git a/tests/accept/run/tsidee3.nim b/tests/accept/run/tsidee3.nim
index be94192e7f..e0c427ab6c 100755
--- a/tests/accept/run/tsidee3.nim
+++ b/tests/accept/run/tsidee3.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tsidee3.nim"
+ output: "5"
+"""
var
global: int
@@ -9,3 +13,5 @@ proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSi
echo noSideEffect(1, 3, dontcare) #OUT 5
+
+
diff --git a/tests/accept/run/tsimmeth.nim b/tests/accept/run/tsimmeth.nim
index c6dbf69bbb..11ff2674f8 100755
--- a/tests/accept/run/tsimmeth.nim
+++ b/tests/accept/run/tsimmeth.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tsimmeth.nim"
+ output: "HELLO WORLD!"
+"""
# Test method simulation
import strutils
@@ -6,3 +10,5 @@ var x = "hello world!".toLower.toUpper
x.echo()
#OUT HELLO WORLD!
+
+
diff --git a/tests/accept/run/tsplit.nim b/tests/accept/run/tsplit.nim
index 711696b9eb..25bad33e20 100755
--- a/tests/accept/run/tsplit.nim
+++ b/tests/accept/run/tsplit.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tsplit.nim"
+ output: "true"
+"""
import strutils
var s = ""
@@ -12,3 +16,5 @@ else:
#OUT true
+
+
diff --git a/tests/accept/run/tstrange.nim b/tests/accept/run/tstrange.nim
index 13aab2302a..3947755fcf 100755
--- a/tests/accept/run/tstrange.nim
+++ b/tests/accept/run/tstrange.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tstrange.nim"
+ output: "hallo4"
+"""
# test for extremely strange bug
proc ack(x: int, y: int): int =
@@ -15,3 +19,5 @@ gen("hallo")
write(stdout, ack(5, 4))
#OUT hallo4
+
+
diff --git a/tests/accept/run/tstrlits.nim b/tests/accept/run/tstrlits.nim
index 48ae082127..1cd43975a6 100755
--- a/tests/accept/run/tstrlits.nim
+++ b/tests/accept/run/tstrlits.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tstrlits.nim"
+ output: "a\"\"long string\"\"\"\"\"abc\"def"
+"""
# Test the new different string literals
const
@@ -12,3 +16,5 @@ stdout.write(tripleEmpty)
stdout.write(raw)
#OUT a""long string"""""abc"def
+
+
diff --git a/tests/accept/run/tstrutil.nim b/tests/accept/run/tstrutil.nim
index 0488d1dc79..80c2f3870e 100755
--- a/tests/accept/run/tstrutil.nim
+++ b/tests/accept/run/tstrutil.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tstrutil.nim"
+ output: "ha/home/a1xyz/usr/bin"
+"""
# test the new strutils module
import
@@ -37,3 +41,5 @@ assert(editDistance("prefix__hallo_suffix", "prefix__hao_suffix") == 2)
main()
#OUT ha/home/a1xyz/usr/bin
+
+
diff --git a/tests/accept/run/tunhandledexc.nim b/tests/accept/run/tunhandledexc.nim
index 36ba5418d5..c60de22348 100755
--- a/tests/accept/run/tunhandledexc.nim
+++ b/tests/accept/run/tunhandledexc.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tunhandledexc.nim"
+ output: "Error: unhandled exception: bla [ESomeOtherErr]"
+"""
type
ESomething = object of E_Base
ESomeOtherErr = object of E_Base
@@ -14,3 +18,5 @@ when True:
except ESomething:
echo("Error happened")
+
+
diff --git a/tests/accept/run/tvardecl.nim b/tests/accept/run/tvardecl.nim
index 496601e3a8..5cc6f4960d 100755
--- a/tests/accept/run/tvardecl.nim
+++ b/tests/accept/run/tvardecl.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tvardecl.nim"
+ output: "44"
+"""
# Test the new variable declaration syntax
var
@@ -7,3 +11,5 @@ var
write(stdout, a)
write(stdout, b) #OUT 44
+
+
diff --git a/tests/accept/run/tvariantasgn.nim b/tests/accept/run/tvariantasgn.nim
index 2cc38f4342..46cc23dd1d 100755
--- a/tests/accept/run/tvariantasgn.nim
+++ b/tests/accept/run/tvariantasgn.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tvariantasgn.nim"
+ output: "came here"
+"""
#BUG
type
TAnyKind = enum
@@ -22,3 +26,5 @@ nr.intVal = 78
# s = nr # works
nr = s # fails!
echo "came here"
+
+
diff --git a/tests/accept/run/tvariantstack.nim b/tests/accept/run/tvariantstack.nim
index e7378ce9a4..d81f6e001a 100755
--- a/tests/accept/run/tvariantstack.nim
+++ b/tests/accept/run/tvariantstack.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tvariantstack.nim"
+ output: "came here"
+"""
#BUG
type
TAnyKind = enum
@@ -44,3 +48,5 @@ stack.push(nr)
var t = stack.pop()
echo "came here"
+
+
diff --git a/tests/accept/run/tvarnums.nim b/tests/accept/run/tvarnums.nim
index 1b683ad940..4f99df8b9b 100755
--- a/tests/accept/run/tvarnums.nim
+++ b/tests/accept/run/tvarnums.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tvarnums.nim"
+ output: "Success!"
+"""
# Test variable length binary integers
import
@@ -134,3 +138,5 @@ tm(low(int32))
tm(high(int32))
writeln(stdout, "Success!") #OUT Success!
+
+
diff --git a/tests/accept/run/tvartup.nim b/tests/accept/run/tvartup.nim
index 05b00b207b..f885cdf373 100755
--- a/tests/accept/run/tvartup.nim
+++ b/tests/accept/run/tvartup.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "tvartup.nim"
+ output: "2 3"
+"""
# Test the new tuple unpacking
proc divmod(a, b: int): tuple[di, mo: int] =
@@ -9,3 +13,5 @@ stdout.write(" ")
stdout.write(y)
#OUT 2 3
+
+
diff --git a/tests/accept/run/twrongexc.nim b/tests/accept/run/twrongexc.nim
index 8ba07bbced..5926937699 100755
--- a/tests/accept/run/twrongexc.nim
+++ b/tests/accept/run/twrongexc.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "twrongexc.nim"
+ output: "Error: unhandled exception [EInvalidValue]"
+"""
try:
raise newException(EInvalidValue, "")
except EOverflow:
echo("Error caught")
+
+
diff --git a/tests/accept/run/txmlgen.nim b/tests/accept/run/txmlgen.nim
index 56ca42d53c..4d52715630 100755
--- a/tests/accept/run/txmlgen.nim
+++ b/tests/accept/run/txmlgen.nim
@@ -1,6 +1,12 @@
+discard """
+ file: "txmlgen.nim"
+ output: ""
+"""
import xmlgen
var nim = "Nimrod"
echo h1(a(href="http://force7.de/nimrod", nim))
+
+
diff --git a/tests/accept/run/txmltree.nim b/tests/accept/run/txmltree.nim
index 2e5f525760..931871f15b 100755
--- a/tests/accept/run/txmltree.nim
+++ b/tests/accept/run/txmltree.nim
@@ -1,3 +1,7 @@
+discard """
+ file: "txmltree.nim"
+ output: "true"
+"""
import xmltree, strtabs
@@ -5,3 +9,5 @@ var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
echo($x == "www.nimrod-test.de")
+
+
diff --git a/tests/reject/spec.csv b/tests/reject/spec.csv
deleted file mode 100755
index f2d38f03b7..0000000000
--- a/tests/reject/spec.csv
+++ /dev/null
@@ -1,41 +0,0 @@
-t99bott.nim;20;constant expression expected
-tadrdisc.nim;15;for a 'var' type a variable needs to be passed
-tambsym.nim;6;ambiguous identifier
-tambsym2.nim;4;undeclared identifier: 'CreateRGBSurface'
-tambsym3.nim;6;ambiguous identifier
-tarraycons.nim;9;invalid order in array constructor
-tatomic.nim;2;identifier expected, but found 'atomic'
-tbind2.nim;7;ambiguous call
-tbind4.nim;4;undeclared identifier: 'lastId'
-tblock1.nim;9;undeclared identifier: 'ha'
-tconstr1.nim;20;type mismatch
-tillrec.nim;8;illegal recursion in type 'TIllegal'
-tinc.nim;3;for a 'var' type a variable needs to be passed
-tinout.nim;7;for a 'var' type a variable needs to be passed
-tinvalidnewseq.nim;10;type mismatch: got (array[0..6, string], int)
-tinvwhen.nim;6;invalid indentation
-titer4.nim;2;iterator within for loop context expected
-tmethod.nim;2;'method' needs a parameter that has an object type
-tnamedparams.nim;3; Error: type mismatch: got (input: string, filename: string, line: int, col: int)
-tnamspc.nim;5;undeclared identifier: 'global'
-tnoop.nim;6;expression 'a()' cannot be called
-tnot.nim;9;type mismatch
-topaque.nim;11;undeclared field: 'buffer'
-topena1.nim;4;invalid type
-toverl.nim;6;attempt to redefine 'TNone'
-trawstr.nim;5;closing " expected
-trecinca.nim;3;recursive dependency: 'tests/reject/trecincb.nim'
-trecincb.nim;4;recursive dependency: 'tests/reject/trecincb.nim'
-treciter.nim;4;recursive dependency: 'myrec'
-trectype.nim;20;internal error: cannot generate C type for: PA
-trefs.nim;15;type mismatch
-tsidee1.nim;7;'SideEffectLyer' can have side effects
-tsidee4.nim;10;type mismatch
-tsimtych.nim;5;type mismatch: got (bool) but expected 'string'
-tstatret.nim;4;statement not allowed after
-tstmtexp.nim;3;value returned by statement has to be discarded
-ttempl2.nim;13;undeclared identifier: 'b'
-ttypelessemptyset.nim;0;Error: internal error: invalid kind for last(tyEmpty)
-tunderscores.nim;3;invalid token: _
-twrongtupleaccess.nim;4;undeclared field: 'setBLAH'
-typredef.nim;2;illegal recursion in type 'Uint8'
diff --git a/tests/reject/t99bott.nim b/tests/reject/t99bott.nim
index 4dfb117015..b514b49d94 100755
--- a/tests/reject/t99bott.nim
+++ b/tests/reject/t99bott.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "t99bott.nim"
+ line: 25
+ errormsg: "constant expression expected"
+"""
## 99 Bottles of Beer
## http://www.99-bottles-of-beer.net/
## Nimrod version
@@ -26,3 +31,5 @@ echo "No more bottles of beer on the wall, no more bottles of beer."
echo "Go to the store and buy some more, 99 bottles of beer on the wall."
+
+
diff --git a/tests/reject/tadrdisc.nim b/tests/reject/tadrdisc.nim
index a7118455fd..0e0324562f 100755
--- a/tests/reject/tadrdisc.nim
+++ b/tests/reject/tadrdisc.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tadrdisc.nim"
+ line: 20
+ errormsg: "for a \'var\' type a variable needs to be passed"
+"""
# Test that the address of a dicriminants cannot be taken
type
@@ -14,3 +19,5 @@ proc setKind(k: var TKind) =
var a: TA
setKind(a.k) #ERROR_MSG for a 'var' type a variable needs to be passed
+
+
diff --git a/tests/reject/tambsym.nim b/tests/reject/tambsym.nim
index b8eae3ba3b..9022746480 100755
--- a/tests/reject/tambsym.nim
+++ b/tests/reject/tambsym.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tambsym.nim"
+ line: 11
+ errormsg: "ambiguous identifier"
+"""
# Test ambiguous symbols
import mambsym1, mambsym2
@@ -6,3 +11,5 @@ var
v: TExport #ERROR_MSG ambiguous identifier
v = y
+
+
diff --git a/tests/reject/tambsym2.nim b/tests/reject/tambsym2.nim
index 3318f3fe2a..98327354d2 100755
--- a/tests/reject/tambsym2.nim
+++ b/tests/reject/tambsym2.nim
@@ -1,6 +1,13 @@
+discard """
+ file: "tambsym2.nim"
+ line: 9
+ errormsg: "undeclared identifier: \'CreateRGBSurface\'"
+"""
from sdl import PSurface
discard SDL.CreateRGBSurface(SDL.SWSURFACE, 23, 34,
32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xff000000'i32)
+
+
diff --git a/tests/reject/tambsym3.nim b/tests/reject/tambsym3.nim
index 96a5098c95..0155f258cd 100755
--- a/tests/reject/tambsym3.nim
+++ b/tests/reject/tambsym3.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tambsym3.nim"
+ line: 11
+ errormsg: "ambiguous identifier"
+"""
# Test ambiguous symbols
import mambsym1, times
@@ -6,3 +11,5 @@ var
v = mDec #ERROR_MSG ambiguous identifier
writeln(stdout, ord(v))
+
+
diff --git a/tests/reject/tarraycons.nim b/tests/reject/tarraycons.nim
index 1809f87359..7de518b6e6 100755
--- a/tests/reject/tarraycons.nim
+++ b/tests/reject/tarraycons.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tarraycons.nim"
+ line: 14
+ errormsg: "invalid order in array constructor"
+"""
type
TEnum = enum
@@ -15,3 +20,5 @@ const
echo myMapping[eC][1]
+
+
diff --git a/tests/reject/tatomic.nim b/tests/reject/tatomic.nim
index 0f1b8125d0..bc119c3b39 100755
--- a/tests/reject/tatomic.nim
+++ b/tests/reject/tatomic.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "tatomic.nim"
+ line: 7
+ errormsg: "identifier expected, but found \'atomic\'"
+"""
var
atomic: int
echo atomic
+
+
diff --git a/tests/reject/tbind2.nim b/tests/reject/tbind2.nim
index 41711083f0..06065538ec 100755
--- a/tests/reject/tbind2.nim
+++ b/tests/reject/tbind2.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tbind2.nim"
+ line: 12
+ errormsg: "ambiguous call"
+"""
# Test the new ``bind`` keyword for templates
proc p1(x: int8, y: int): int = return x + y
@@ -8,3 +13,5 @@ template tempBind(x, y: expr): expr =
echo tempBind(1'i8, 2'i8)
+
+
diff --git a/tests/reject/tbind4.nim b/tests/reject/tbind4.nim
index d0b5fc0620..ae525f06e7 100755
--- a/tests/reject/tbind4.nim
+++ b/tests/reject/tbind4.nim
@@ -1,6 +1,13 @@
+discard """
+ file: "tbind4.nim"
+ line: 9
+ errormsg: "undeclared identifier: \'lastId\'"
+"""
# Module B
import mbind4
echo genId() #ERROR_MSG instantiation from here
+
+
diff --git a/tests/reject/tblock1.nim b/tests/reject/tblock1.nim
index 0bea7ae7f9..5c41aaf821 100755
--- a/tests/reject/tblock1.nim
+++ b/tests/reject/tblock1.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tblock1.nim"
+ line: 14
+ errormsg: "undeclared identifier: \'ha\'"
+"""
# check for forward label and
# for failure when label is not declared
@@ -9,3 +14,5 @@ proc main =
break ha #ERROR
main()
+
+
diff --git a/tests/reject/tconstr1.nim b/tests/reject/tconstr1.nim
index 4881703504..cb65942134 100755
--- a/tests/reject/tconstr1.nim
+++ b/tests/reject/tconstr1.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tconstr1.nim"
+ line: 25
+ errormsg: "type mismatch"
+"""
# Test array, record constructors
type
@@ -21,3 +26,5 @@ const
otherThings = [ # the same
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]
+
+
diff --git a/tests/reject/tillrec.nim b/tests/reject/tillrec.nim
index 21ce19889e..3f8fe60fca 100755
--- a/tests/reject/tillrec.nim
+++ b/tests/reject/tillrec.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tillrec.nim"
+ line: 13
+ errormsg: "illegal recursion in type \'TIllegal\'"
+"""
# test illegal recursive types
type
@@ -8,3 +13,5 @@ type
TIllegal {.final.} = object #ERROR_MSG illegal recursion in type 'TIllegal'
y: Int
x: array[0..3, TIllegal]
+
+
diff --git a/tests/reject/tinc.nim b/tests/reject/tinc.nim
index 26fe32a416..8038a2a01b 100755
--- a/tests/reject/tinc.nim
+++ b/tests/reject/tinc.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "tinc.nim"
+ line: 8
+ errormsg: "for a \'var\' type a variable needs to be passed"
+"""
var x = 0
inc(x+1)
+
+
diff --git a/tests/reject/tinout.nim b/tests/reject/tinout.nim
index b4fe2fb10b..034c496f5b 100755
--- a/tests/reject/tinout.nim
+++ b/tests/reject/tinout.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tinout.nim"
+ line: 12
+ errormsg: "for a \'var\' type a variable needs to be passed"
+"""
# Test in out checking for parameters
proc abc(x: var int) =
@@ -7,3 +12,5 @@ proc b() =
abc(3) #ERROR
b()
+
+
diff --git a/tests/reject/tinvalidnewseq.nim b/tests/reject/tinvalidnewseq.nim
index ccd327284f..a8cc367834 100755
--- a/tests/reject/tinvalidnewseq.nim
+++ b/tests/reject/tinvalidnewseq.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tinvalidnewseq.nim"
+ line: 15
+ errormsg: "type mismatch: got (array[0..6, string], int)"
+"""
import re, strutils
type
@@ -18,3 +23,5 @@ var r: TUrl
r = parseUrl(r"http://google.com/search?var=bleahdhsad")
echo(r.domain)
+
+
diff --git a/tests/reject/tinvwhen.nim b/tests/reject/tinvwhen.nim
index 8dc8cbf506..ea8a7ddf0e 100755
--- a/tests/reject/tinvwhen.nim
+++ b/tests/reject/tinvwhen.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tinvwhen.nim"
+ line: 11
+ errormsg: "invalid indentation"
+"""
# This was parsed even though it should not!
proc chdir(path: CString): cint {.importc: "chdir", header: "dirHeader".}
@@ -6,3 +11,5 @@ proc getcwd(buf: CString, buflen: cint): CString
when defined(unix): {.importc: "getcwd", header: "".} #ERROR_MSG invalid indentation
elif defined(windows): {.importc: "getcwd", header: ""}
else: {.error: "os library not ported to your OS. Please help!".}
+
+
diff --git a/tests/reject/titer4.nim b/tests/reject/titer4.nim
index 376522482c..d9d8855439 100755
--- a/tests/reject/titer4.nim
+++ b/tests/reject/titer4.nim
@@ -1,3 +1,10 @@
+discard """
+ file: "titer4.nim"
+ line: 7
+ errormsg: "iterator within for loop context expected"
+"""
for x in {'a'..'z'}: #ERROR_MSG iterator within for loop context expected
nil
+
+
diff --git a/tests/reject/tmethod.nim b/tests/reject/tmethod.nim
index 101cabf253..999016072b 100755
--- a/tests/reject/tmethod.nim
+++ b/tests/reject/tmethod.nim
@@ -1,4 +1,11 @@
+discard """
+ file: "tmethod.nim"
+ line: 7
+ errormsg: "\'method\' needs a parameter that has an object type"
+"""
method m(i: int): int =
return 5
+
+
diff --git a/tests/reject/tnamedparams.nim b/tests/reject/tnamedparams.nim
index 6c59518b34..1772bd938b 100755
--- a/tests/reject/tnamedparams.nim
+++ b/tests/reject/tnamedparams.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tnamedparams.nim"
+ line: 8
+ errormsg: "Error: type mismatch: got (input: string, filename: string, line: int, col: int)"
+"""
import pegs
discard parsePeg(
@@ -6,3 +11,5 @@ discard parsePeg(
line = 1,
col = 23)
+
+
diff --git a/tests/reject/tnamspc.nim b/tests/reject/tnamspc.nim
index eddaacfd80..1e2049cecd 100755
--- a/tests/reject/tnamspc.nim
+++ b/tests/reject/tnamspc.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "tnamspc.nim"
+ line: 10
+ errormsg: "undeclared identifier: \'global\'"
+"""
# Test17 - test correct handling of namespaces
import mnamspc1
global = 9 #ERROR
+
+
diff --git a/tests/reject/tnoop.nim b/tests/reject/tnoop.nim
index d097553e86..2d320c8499 100755
--- a/tests/reject/tnoop.nim
+++ b/tests/reject/tnoop.nim
@@ -1,6 +1,13 @@
+discard """
+ file: "tnoop.nim"
+ line: 11
+ errormsg: "expression \'a()\' cannot be called"
+"""
# Tests the new check in the semantic pass
var
a: int
a() #ERROR_MSG expression 'a()' cannot be called
+
+
diff --git a/tests/reject/tnot.nim b/tests/reject/tnot.nim
index cda551654a..cd0f538e62 100755
--- a/tests/reject/tnot.nim
+++ b/tests/reject/tnot.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tnot.nim"
+ line: 14
+ errormsg: "type mismatch"
+"""
# BUG: following compiles, but should not:
proc nodeOfDegree(x: Int): bool =
@@ -13,3 +18,5 @@ proc main =
main()
+
+
diff --git a/tests/reject/topaque.nim b/tests/reject/topaque.nim
index 7553a749e6..ac390835b4 100755
--- a/tests/reject/topaque.nim
+++ b/tests/reject/topaque.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "topaque.nim"
+ line: 16
+ errormsg: "undeclared field: \'buffer\'"
+"""
# Test the new opaque types
import
@@ -9,3 +14,5 @@ var
L.filename = "ha"
L.line = 34
L.buffer[0] = '\0' #ERROR_MSG undeclared field: 'buffer'
+
+
diff --git a/tests/reject/topena1.nim b/tests/reject/topena1.nim
index 7351edf557..0dbc5506a8 100755
--- a/tests/reject/topena1.nim
+++ b/tests/reject/topena1.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "topena1.nim"
+ line: 9
+ errormsg: "invalid type"
+"""
# Tests a special bug
var
x: ref openarray[string] #ERROR_MSG invalid type
+
+
diff --git a/tests/reject/toverl.nim b/tests/reject/toverl.nim
index 94f251cac9..5c5f8d4407 100755
--- a/tests/reject/toverl.nim
+++ b/tests/reject/toverl.nim
@@ -1,6 +1,13 @@
+discard """
+ file: "toverl.nim"
+ line: 11
+ errormsg: "attempt to redefine \'TNone\'"
+"""
# Test for overloading
type
TNone {.exportc: "_NONE", final.} = object
proc TNone(a, b: int) = nil #ERROR_MSG attempt to redefine 'TNone'
+
+
diff --git a/tests/reject/trawstr.nim b/tests/reject/trawstr.nim
index 7b2db03355..ab2aae1593 100755
--- a/tests/reject/trawstr.nim
+++ b/tests/reject/trawstr.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "trawstr.nim"
+ line: 10
+ errormsg: "closing \" expected"
+"""
# Test the new raw strings:
const
xxx = r"This is a raw string!"
yyy = "This not\" #ERROR
+
+
diff --git a/tests/reject/trecinca.nim b/tests/reject/trecinca.nim
index d78fee233e..a567c84db7 100755
--- a/tests/reject/trecinca.nim
+++ b/tests/reject/trecinca.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "trecinca.nim"
+ line: 8
+ errormsg: "recursive dependency: \'tests/reject/trecincb.nim\'"
+"""
# Test recursive includes
include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim'
echo "trecina"
+
+
diff --git a/tests/reject/trecincb.nim b/tests/reject/trecincb.nim
index 6191671a12..937c5e4884 100755
--- a/tests/reject/trecincb.nim
+++ b/tests/reject/trecincb.nim
@@ -1,6 +1,13 @@
+discard """
+ file: "trecincb.nim"
+ line: 9
+ errormsg: "recursive dependency: \'tests/reject/trecincb.nim\'"
+"""
# Test recursive includes
include trecincb #ERROR_MSG recursive dependency: 'tests/trecincb.nim'
echo "trecinb"
+
+
diff --git a/tests/reject/treciter.nim b/tests/reject/treciter.nim
index 6622392859..dacdbdfd78 100755
--- a/tests/reject/treciter.nim
+++ b/tests/reject/treciter.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "treciter.nim"
+ line: 9
+ errormsg: "recursive dependency: \'myrec\'"
+"""
# Test that an error message occurs for a recursive iterator
iterator myrec(n: int): int =
@@ -5,3 +10,5 @@ iterator myrec(n: int): int =
yield x
for x in myrec(10): echo x
+
+
diff --git a/tests/reject/trectype.nim b/tests/reject/trectype.nim
index a7a6f56e09..e9bf8234df 100755
--- a/tests/reject/trectype.nim
+++ b/tests/reject/trectype.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "trectype.nim"
+ line: 25
+ errormsg: "internal error: cannot generate C type for: PA"
+"""
# Test recursive type descriptions
# (mainly for the C code generator)
@@ -19,3 +24,5 @@ var
new(x)
#ERROR_MSG internal error: cannot generate C type for: PA
+
+
diff --git a/tests/reject/trefs.nim b/tests/reject/trefs.nim
index ab39340884..b157ca2b56 100755
--- a/tests/reject/trefs.nim
+++ b/tests/reject/trefs.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "trefs.nim"
+ line: 20
+ errormsg: "type mismatch"
+"""
# test for ref types (including refs to procs)
type
@@ -14,3 +19,5 @@ p = foo
write(stdout, "success!")
p = wrongfoo #ERROR_MSG type mismatch
+
+
diff --git a/tests/reject/tsidee1.nim b/tests/reject/tsidee1.nim
index 3bd520680c..bd5b32dd75 100755
--- a/tests/reject/tsidee1.nim
+++ b/tests/reject/tsidee1.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tsidee1.nim"
+ line: 12
+ errormsg: "\'SideEffectLyer\' can have side effects"
+"""
var
global: int
@@ -9,3 +14,5 @@ proc SideEffectLyer(x, y: int): int {.noSideEffect.} = #ERROR_MSG 'SideEffectLye
echo SideEffectLyer(1, 3)
+
+
diff --git a/tests/reject/tsidee4.nim b/tests/reject/tsidee4.nim
index 55c474d10e..cbebfbd369 100755
--- a/tests/reject/tsidee4.nim
+++ b/tests/reject/tsidee4.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tsidee4.nim"
+ line: 15
+ errormsg: "type mismatch"
+"""
var
global: int
@@ -8,3 +13,5 @@ proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSi
return x + y + dontcare(x)
echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch
+
+
diff --git a/tests/reject/tsimtych.nim b/tests/reject/tsimtych.nim
index b100c62e31..dd969958c5 100755
--- a/tests/reject/tsimtych.nim
+++ b/tests/reject/tsimtych.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "tsimtych.nim"
+ line: 10
+ errormsg: "type mismatch: got (bool) but expected \'string\'"
+"""
# Test 2
# Simple type checking
var a: string
a = false #ERROR
+
+
diff --git a/tests/reject/tstatret.nim b/tests/reject/tstatret.nim
index ac93ac5322..bf90255a01 100755
--- a/tests/reject/tstatret.nim
+++ b/tests/reject/tstatret.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "tstatret.nim"
+ line: 9
+ errormsg: "statement not allowed after"
+"""
# no statement after return
proc main() =
return
echo("huch?") #ERROR_MSG statement not allowed after
+
+
diff --git a/tests/reject/tstmtexp.nim b/tests/reject/tstmtexp.nim
index f4d83e83fc..50248ad329 100755
--- a/tests/reject/tstmtexp.nim
+++ b/tests/reject/tstmtexp.nim
@@ -1,3 +1,10 @@
+discard """
+ file: "tstmtexp.nim"
+ line: 8
+ errormsg: "value returned by statement has to be discarded"
+"""
# Test 3
1+4 #ERROR_MSG value returned by statement has to be discarded
+
+
diff --git a/tests/reject/ttempl2.nim b/tests/reject/ttempl2.nim
index fba6bd0cb0..fba988f957 100755
--- a/tests/reject/ttempl2.nim
+++ b/tests/reject/ttempl2.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "ttempl2.nim"
+ line: 18
+ errormsg: "undeclared identifier: \'b\'"
+"""
template declareInScope(x: expr, t: typeDesc): stmt =
var x: t
@@ -12,3 +17,5 @@ a = 42 # works, `a` is known here
declareInNewScope(b, int)
b = 42 #ERROR_MSG undeclared identifier: 'b'
+
+
diff --git a/tests/reject/ttypelessemptyset.nim b/tests/reject/ttypelessemptyset.nim
index a49cb8fa00..2335de3596 100755
--- a/tests/reject/ttypelessemptyset.nim
+++ b/tests/reject/ttypelessemptyset.nim
@@ -1,4 +1,11 @@
+discard """
+ file: "ttypelessemptyset.nim"
+ line: 5
+ errormsg: "Error: internal error: invalid kind for last(tyEmpty)"
+"""
var q = false
discard (if q: {} else: {})
+
+
diff --git a/tests/reject/tunderscores.nim b/tests/reject/tunderscores.nim
index 459cfda30b..8075fdae45 100755
--- a/tests/reject/tunderscores.nim
+++ b/tests/reject/tunderscores.nim
@@ -1,3 +1,8 @@
+discard """
+ file: "tunderscores.nim"
+ line: 8
+ errormsg: "invalid token: _"
+"""
# Bug #502670
var ef_ = 3 #ERROR_MSG invalid token: _
@@ -5,3 +10,5 @@ var a__b = 1
var c___d = 2
echo(ab, cd, ef_)
+
+
diff --git a/tests/reject/twrongtupleaccess.nim b/tests/reject/twrongtupleaccess.nim
index f706e267c1..bb09b108d6 100755
--- a/tests/reject/twrongtupleaccess.nim
+++ b/tests/reject/twrongtupleaccess.nim
@@ -1,5 +1,12 @@
+discard """
+ file: "twrongtupleaccess.nim"
+ line: 9
+ errormsg: "undeclared field: \'setBLAH\'"
+"""
# Bugfix
var v = (5.0, 10.0)
v.setBLAH(10)
+
+
diff --git a/tests/reject/typredef.nim b/tests/reject/typredef.nim
index a77d91f40e..b2182d116d 100755
--- a/tests/reject/typredef.nim
+++ b/tests/reject/typredef.nim
@@ -1,3 +1,10 @@
+discard """
+ file: "typredef.nim"
+ line: 7
+ errormsg: "illegal recursion in type \'Uint8\'"
+"""
type
Uint8 = Uint8 #ERROR_MSG illegal recursion in type 'Uint8'
+
+
diff --git a/tests/tester.nim b/tests/tester.nim
index 1c21e7afc6..37dbf13883 100755
--- a/tests/tester.nim
+++ b/tests/tester.nim
@@ -10,7 +10,7 @@
## This program verifies Nimrod against the testcases.
import
- strutils, pegs, os, osproc, streams, parsecsv, browsers
+ parseutils, strutils, pegs, os, osproc, streams, parsecfg, browsers
const
cmdTemplate = r"nimrod cc --hints:on $# $#"
@@ -21,12 +21,72 @@ type
file: string,
line: int,
msg: string,
- err: bool]
- TOutp = tuple[file, outp: string]
+ err: bool,
+ disabled: bool]
+ TOutp = tuple[file, outp: string, disabled: bool]
TResults = object
- total, passed: int
+ total, passed, skipped: int
data: string
+# ----------------------- Spec parser ----------------------------------------
+
+when not defined(parseCfgBool):
+ # candidate for the stdlib:
+ proc parseCfgBool(s: string): bool =
+ case normalize(s)
+ of "y", "yes", "true", "1", "on": result = true
+ of "n", "no", "false", "0", "off": result = false
+ else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s)
+
+proc extractSpec(filename: string): string =
+ const tripleQuote = "\"\"\""
+ var x = readFile(filename)
+ if isNil(x): quit "cannot open file: " & filename
+ var a = x.find(tripleQuote)
+ var b = x.find(tripleQuote, a+3)
+ if a >= 0 and b > a:
+ result = x.copy(a+3, b-1).replace("'''", tripleQuote)
+ else:
+ echo "warning: file does not contain spec: " & filename
+
+template parseTest(fillResult: stmt) =
+ var ss = newStringStream(extractSpec(filename))
+ var p: TCfgParser
+ open(p, ss, filename, 1)
+ while true:
+ var e = next(p)
+ case e.kind
+ of cfgEof: break
+ of cfgSectionStart, cfgOption, cfgError:
+ echo ignoreMsg(p, e)
+ of cfgKeyValuePair:
+ fillResult
+ close(p)
+
+proc parseRejectTest(filename: string): TMsg =
+ result.file = filename
+ result.err = true
+ result.msg = ""
+ parseTest:
+ case normalize(e.key)
+ of "file": result.file = e.value
+ of "line": discard parseInt(e.value, result.line)
+ of "errormsg": result.msg = e.value
+ of "disabled": result.disabled = parseCfgBool(e.value)
+ else: echo ignoreMsg(p, e)
+
+proc parseRunTest(filename: string): TOutp =
+ result.file = filename
+ result.outp = ""
+ parseTest:
+ case normalize(e.key)
+ of "file": result.file = e.value
+ of "output": result.outp = e.value
+ of "disabled": result.disabled = parseCfgBool(e.value)
+ else: echo ignoreMsg(p, e)
+
+# ----------------------------------------------------------------------------
+
proc myExec(cmd: string): string =
result = osproc.execProcess(cmd)
@@ -62,38 +122,16 @@ proc callCompiler(filename, options: string): TMsg =
elif s =~ pegSuccess:
result.err = false
-proc setupCvsParser(csvFile: string): TCsvParser =
- var s = newFileStream(csvFile, fmRead)
- if s == nil: quit("cannot open the file" & csvFile)
- result.open(s, csvFile, separator=';', skipInitialSpace=true)
-
-proc parseRejectData(dir: string): seq[TMsg] =
- var p = setupCvsParser(dir / "spec.csv")
- result = @[]
- while readRow(p, 3):
- result.add((p.row[0], parseInt(p.row[1]), p.row[2], true))
- close(p)
-
-proc parseRunData(dir: string): seq[TOutp] =
- var p = setupCvsParser(dir / "spec.csv")
- result = @[]
- while readRow(p, 2):
- result.add((p.row[0], p.row[1]))
- close(p)
-
-proc findSpec[T](specs: seq[T], filename: string): int =
- while result < specs.len:
- if specs[result].file == filename: return
- inc(result)
- quit("cannot find spec for file: " & filename)
-
proc initResults: TResults =
result.total = 0
result.passed = 0
+ result.skipped = 0
result.data = ""
proc `$`(x: TResults): string =
- result = "Tests passed: " & $x.passed & "/" & $x.total & "
\n"
+ result = ("Tests passed: $1 / $3
\n" &
+ "Tests skipped: $2 / $3
\n") %
+ [$x.passed, $x.skipped, $x.total]
proc colorBool(b: bool): string =
if b: result = "yes"
@@ -147,15 +185,15 @@ proc cmpMsgs(r: var TResults, expected, given: TMsg, test: string) =
proc reject(r: var TResults, dir, options: string) =
## handle all the tests that the compiler should reject
- var specs = parseRejectData(dir)
-
for test in os.walkFiles(dir / "t*.nim"):
var t = extractFilename(test)
inc(r.total)
echo t
- var expected = findSpec(specs, t)
- var given = callCompiler(test, options)
- cmpMsgs(r, specs[expected], given, t)
+ var expected = parseRejectTest(test)
+ if expected.disabled: inc(r.skipped)
+ else:
+ var given = callCompiler(test, options)
+ cmpMsgs(r, expected, given, t)
proc compile(r: var TResults, pattern, options: string) =
for test in os.walkFiles(pattern):
@@ -167,24 +205,25 @@ proc compile(r: var TResults, pattern, options: string) =
if not given.err: inc(r.passed)
proc run(r: var TResults, dir, options: string) =
- var specs = parseRunData(dir)
for test in os.walkFiles(dir / "t*.nim"):
var t = extractFilename(test)
- inc(r.total)
echo t
- var given = callCompiler(test, options)
- if given.err:
- r.addResult(t, "", given.msg, not given.err)
+ inc(r.total)
+ var expected = parseRunTest(test)
+ if expected.disabled: inc(r.skipped)
else:
- var exeFile = changeFileExt(test, ExeExt)
- var expected = specs[findSpec(specs, t)]
- if existsFile(exeFile):
- var buf = myExec(exeFile)
- var success = strip(buf) == strip(expected.outp)
- if success: inc(r.passed)
- r.addResult(t, expected.outp, buf, success)
+ var given = callCompiler(test, options)
+ if given.err:
+ r.addResult(t, "", given.msg, not given.err)
else:
- r.addResult(t, expected.outp, "executable not found", false)
+ var exeFile = changeFileExt(test, ExeExt)
+ if existsFile(exeFile):
+ var buf = myExec(exeFile)
+ var success = strip(buf) == strip(expected.outp)
+ if success: inc(r.passed)
+ r.addResult(t, expected.outp, buf, success)
+ else:
+ r.addResult(t, expected.outp, "executable not found", false)
var options = ""
var rejectRes = initResults()
@@ -202,3 +241,4 @@ compile(compileRes, "examples/gtk/*.nim", options)
run(runRes, "tests/accept/run", options)
listResults(rejectRes, compileRes, runRes)
openDefaultBrowser(resultsFile)
+
diff --git a/todo.txt b/todo.txt
index d7a3e45167..5958cfa019 100755
--- a/todo.txt
+++ b/todo.txt
@@ -5,7 +5,6 @@
add --deadlock_prevention:on|off switch
- built-in serialization
-- we need a way to disable tests
- deprecate ^ and make it available as operator
- test branch coverage
- checked exceptions
diff --git a/tools/buildsh.tmpl b/tools/buildsh.tmpl
index 6104205831..d8c59628b2 100755
--- a/tools/buildsh.tmpl
+++ b/tools/buildsh.tmpl
@@ -60,6 +60,8 @@ case $ucpu in
mycpu="amd64" ;;
*sparc*|*sun* )
mycpu="sparc" ;;
+ *ppc64* )
+ mycpu="powerpc64" ;;
*power*|*Power* )
mycpu="powerpc" ;;
*mips* )
diff --git a/web/news.txt b/web/news.txt
index 7ba934bd0d..e74d896995 100755
--- a/web/news.txt
+++ b/web/news.txt
@@ -32,6 +32,8 @@ Changes affecting backwards compatibility
- Deprecated ``os.getApplicationDir``: Use ``os.getAppDir`` instead.
- Changed and documented how generalized string literals work: The syntax
``module.re"abc"`` is now supported.
+- Changed the behaviour of ``strutils.%``, ``ropes.%``
+ if both ``$#`` and ``$i`` are involved.
Additions