require errormsg to be specified before file.

This commit is contained in:
Arne Döring
2018-11-29 16:07:51 +01:00
committed by Araq
parent ca394ebd95
commit 1105d03644
264 changed files with 305 additions and 623 deletions

View File

@@ -299,17 +299,28 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
# edit when making a conscious breaking change, also please try to make your
# commit message clear and notify me so I can easily compile an errata later.
const refHashes = @[
"51afdfa84b3ca3d810809d6c4e5037ba", "30f07e4cd5eaec981f67868d4e91cfcf",
"d14e7c032de36d219c9548066a97e846", "2e40bfd5daadb268268727da91bb4e81",
"c5d3853ed0aba04bf6d35ba28a98dca0", "058603145ff92d46c009006b06e5b228",
"7b94a029b94ddb7efafddd546c965ff6", "586d74514394e49f2370dfc01dd9e830",
"13febc363ed82585f2a60de40ddfefda", "c11a013db35e798f44077bc0763cc86d",
"3e32e2c5e9a24bd13375e1cd0467079c", "0b9fe7ba159623d49ae60db18a15037c",
"b2dd5293d7f784824bbf9792c6fb51ad", "4c19d8d9026bfe151b31d7007fa3c237",
"9415c6a568cfceed08da8378e95b5cd5", "da520038c153f4054cb8cc5faa617714",
"e6c6e061b6f77b2475db6fec7abfb7f4", "9a8fe78c588d08018843b64b57409a02",
"8b5d28e985c0542163927d253a3e4fc9", "783299b98179cc725f9c46b5e3b5381f",
"bc523f9a9921299090bac1af6c958e73", "80f9c3e594a798225046e8a42e990daf"
"51afdfa84b3ca3d810809d6c4e5037ba",
"30f07e4cd5eaec981f67868d4e91cfcf",
"d14e7c032de36d219c9548066a97e846",
"b335635562ff26ec0301bdd86356ac0c",
"6c4add749fbf50860e2f523f548e6b0e",
"76de5833a7cc46f96b006ce51179aeb1",
"705eff79844e219b47366bd431658961",
"a1e87b881c5eb161553d119be8b52f64",
"13febc363ed82585f2a60de40ddfefda",
"c11a013db35e798f44077bc0763cc86d",
"3e32e2c5e9a24bd13375e1cd0467079c",
"0b9fe7ba159623d49ae60db18a15037c",
"b2dd5293d7f784824bbf9792c6fb51ad",
"4c19d8d9026bfe151b31d7007fa3c237",
"9415c6a568cfceed08da8378e95b5cd5",
"da520038c153f4054cb8cc5faa617714",
"e6c6e061b6f77b2475db6fec7abfb7f4",
"9a8fe78c588d08018843b64b57409a02",
"8b5d28e985c0542163927d253a3e4fc9",
"783299b98179cc725f9c46b5e3b5381f",
"bc523f9a9921299090bac1af6c958e73",
"80f9c3e594a798225046e8a42e990daf",
]
for i, test in tests:
@@ -317,6 +328,8 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
let testHash = getMD5(readFile(filename).string)
doAssert testHash == refHashes[i], "Nim in Action test " & filename & " was changed."
# Run the tests.
for testfile in tests:
test "tests/" & testfile & ".nim"

View File

@@ -143,10 +143,16 @@ proc parseSpec*(filename: string): TSpec =
else:
result.parseErrors.addLine "cannot interpret as action: ", e.value
of "file":
if result.msg.len == 0 and result.nimout.len == 0:
result.parseErrors.addLine "errormsg or msg needs to be specified before file"
result.file = e.value
of "line":
if result.msg.len == 0 and result.nimout.len == 0:
result.parseErrors.addLine "errormsg, msg or nimout needs to be specified before line"
discard parseInt(e.value, result.line)
of "column":
if result.msg.len == 0 and result.nimout.len == 0:
result.parseErrors.addLine "errormsg or msg needs to be specified before column"
discard parseInt(e.value, result.column)
of "tfile":
result.tfile = e.value

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "ambiguous identifier"
file: "tambsym.nim"
line: 11
errormsg: "ambiguous identifier"
"""
# Test ambiguous symbols
@@ -11,5 +11,3 @@ var
v: TExport #ERROR_MSG ambiguous identifier
v = y

View File

@@ -1,5 +1,4 @@
discard """
file: "tambsym2.nim"
output: "7"
"""
# Test overloading of procs with locals
@@ -20,5 +19,3 @@ m.len = 7
m.data = "1234"
x(m, 5) #OUT 7

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "ambiguous identifier"
file: "tambsym3.nim"
line: 11
errormsg: "ambiguous identifier"
"""
# Test ambiguous symbols
@@ -11,5 +11,3 @@ var
v = mDec #ERROR_MSG ambiguous identifier
writeLine(stdout, ord(v))

View File

@@ -1,5 +1,4 @@
discard """
file: "tambsys.nim"
output: ""
"""
# Test ambiguous symbols
@@ -9,5 +8,3 @@ import mambsys1, mambsys2
var
v: mambsys1.TExport
mambsys2.foo(3) #OUT

View File

@@ -1,7 +1,5 @@
discard """
file: "tarray.nim"
output:
'''
output: '''
[4, 5, 6]
[16, 25, 36]

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "invalid order in array constructor"
file: "tarraycons.nim"
line: 14
errormsg: "invalid order in array constructor"
"""
type
@@ -19,6 +19,3 @@ const
]
echo myMapping[eC][1]

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "type mismatch: got <ptr Hard[system.string]> but expected 'Book[system.string]'"
file: "tarraycons_ptr_generic2.nim"
line: 17
errormsg: "type mismatch: got <ptr Hard[system.string]> but expected 'Book[system.string]'"
"""
type

View File

@@ -1,5 +1,4 @@
discard """
file: "tassert.nim"
outputsub: "assertion failure!this shall be always written"
exitcode: "1"
"""
@@ -19,5 +18,3 @@ finally:
system.write(stdout, "this shall be always written")
assert(false) #OUT assertion failure!this shall be always written

View File

@@ -1,5 +1,4 @@
discard """
file: "tassign.nim"
output:
'''
TEMP=C:\Programs\xyz\bin

View File

@@ -1,7 +1,7 @@
discard """
file: "tvariantasgn.nim"
output: "came here"
"""
#BUG
type
TAnyKind = enum
@@ -26,5 +26,3 @@ nr.intVal = 78
# s = nr # works
nr = s # fails!
echo "came here"

View File

@@ -1,7 +1,3 @@
discard """
file: "t7758.nim"
exitcode: 0
"""
import asyncdispatch
proc task() {.async.} =
@@ -16,4 +12,4 @@ proc main() =
doAssert counter <= 4
for i in 0 .. 10: main()
for i in 0 .. 10: main()

View File

@@ -1,6 +1,5 @@
discard """
file: "tasyncRecvLine.nim"
output: '''
output: '''
Hello World
Hello World
'''

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "'anotherGCSafeAsyncProcIter' is not GC-safe as it calls 'asyncGCUnsafeProc'"
cmd: "nim c --threads:on $file"
file: "asyncmacro.nim"
errormsg: "'anotherGCSafeAsyncProcIter' is not GC-safe as it calls 'asyncGCUnsafeProc'"
"""
assert compileOption("threads"), "this test will not do anything useful without --threads:on"

View File

@@ -1,5 +1,4 @@
discard """
file: "tasyncall.nim"
exitcode: 0
"""
import times, sequtils

View File

@@ -1,5 +1,4 @@
discard """
file: "tasyncawait.nim"
output: "5000"
"""
import asyncdispatch, nativesockets, net, strutils, os

View File

@@ -1,7 +1,6 @@
discard """
file: "tasyncconnect.nim"
exitcode: 1
outputsub: "Error: unhandled exception: Connection refused"
exitcode: 1
"""
import

View File

@@ -1,5 +1,4 @@
discard """
file: "tasyncdial.nim"
output: '''
OK AF_INET
OK AF_INET6

View File

@@ -1,7 +1,6 @@
discard """
file: "tasyncexceptions.nim"
exitcode: 1
outputsub: "Error: unhandled exception: foobar"
exitcode: 1
"""
import asyncdispatch

View File

@@ -1,10 +1,9 @@
discard """
output: '''13
output: '''
13
hello humans!
13
'''
file: "tasyncfile.nim"
exitcode: 0
"""
import asyncfile, asyncdispatch, os

View File

@@ -1,6 +1,5 @@
discard """
file: "tasyncrecursion.nim"
output: "50005000"
output: "50005000"
"""
import asyncdispatch

View File

@@ -1,6 +1,5 @@
discard """
file: "tasyncsend4754.nim"
output: "Finished"
output: "Finished"
"""
import asyncdispatch, asyncnet

View File

@@ -1,5 +1,4 @@
discard """
file: "tasyncssl.nim"
cmd: "nim $target --hints:on --define:ssl $options $file"
output: "500"
disabled: "windows"

View File

@@ -1,7 +1,5 @@
discard """
file: "tasynctry.nim"
exitcode: 0
output: '''
output: '''
Generic except: Test
Specific except
Multiple idents in except

View File

@@ -1,7 +1,5 @@
discard """
file: "tawaitsemantics.nim"
exitcode: 0
output: '''
output: '''
Error can be caught using yield
Infix `or` raises
Infix `and` raises

View File

@@ -1,7 +1,5 @@
discard """
file: "tfuturestream.nim"
exitcode: 0
output: '''
output: '''
0
1
2
@@ -70,4 +68,4 @@ waitFor testCompletion()
# echo("Finished")
# waitFor omega()
# waitFor omega()

View File

@@ -1,5 +1,4 @@
discard """
file: "tioselectors.nim"
output: "All tests passed!"
"""
import selectors

View File

@@ -1,5 +1,4 @@
discard """
file: "tnewasyncudp.nim"
output: "5000"
"""
import asyncdispatch, nativesockets, net, strutils, os

View File

@@ -1,6 +1,4 @@
discard """
file: "tpendingcheck.nim"
exitcode: 0
output: ""
"""
@@ -18,4 +16,3 @@ while not f.finished:
f.read
doAssert(not hasPendingOperations())

View File

@@ -1,5 +1,4 @@
discard """
file: "twinasyncrw.nim"
output: "5000"
"""
when defined(windows):

View File

@@ -1,7 +1,5 @@
discard """
file: "tbind.nim"
output:
'''
output: '''
3
1
1

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "ambiguous call"
file: "tbind2.nim"
line: 12
errormsg: "ambiguous call"
"""
# Test the new ``bind`` keyword for templates
@@ -12,6 +12,3 @@ template tempBind(x, y): untyped =
(bind p1(x, y)) #ERROR_MSG ambiguous call
echo tempBind(1'i8, 2'i8)

View File

@@ -1,6 +1,6 @@
discard """
line: 10
errormsg: "type mismatch: got <type float, string>"
line: 10
"""
proc foo(T: typedesc; some: T) =
@@ -8,4 +8,3 @@ proc foo(T: typedesc; some: T) =
foo int, 4
foo float, "bad"

View File

@@ -1,6 +1,6 @@
discard """
line: 18
errormsg: "type mismatch: got <proc (s: TScgi: ScgiState or AsyncScgiState) | proc (client: AsyncSocket, headers: StringTableRef, input: string){.noSideEffect, gcsafe, locks: 0.}>"
line: 18
"""
#bug #442

View File

@@ -1,6 +1,6 @@
discard """
line: 11
errormsg: "no symbol to borrow from found"
line: 11
"""
# bug #516
@@ -14,4 +14,3 @@ var
d, e: TAtom
echo( $(d == e) )

View File

@@ -1,6 +1,6 @@
discard """
line: 13
errormsg: "case statement cannot work on enums with holes for computed goto"
line: 13
"""
type

View File

@@ -1,13 +1,17 @@
discard """
errormsg: "type mismatch: got <string> but expected 'int'"
line: 33
file: "tcaseexpr1.nim"
line: 29
errormsg: "type mismatch: got <string> but expected 'int'"
line: 23
errormsg: "not all cases are covered"
line: 27
file: "tcaseexpr1.nim"
"""
# NOTE: This spec is wrong. Spec doesn't support multiple error
# messages. The first one is simply overridden by the second one.
# This just has never been noticed.
type
E = enum A, B, C
@@ -27,4 +31,3 @@ var t1 = case x:
var t2 = case x:
of A: 10
of B, C: "23"

View File

@@ -1,6 +1,6 @@
discard """
line: 13
errormsg: "duplicate case label"
line: 13
"""
type

View File

@@ -1,6 +1,6 @@
discard """
line: 13
errormsg: "duplicate case label"
line: 13
"""

View File

@@ -1,6 +1,5 @@
discard """
file: "tcasestmt.nim"
output:
output:
'''
Not found!
Found!
@@ -226,4 +225,4 @@ block tcasestm:
"invalid Y".quit(3)
true
else: raise newException(ValueError, "Invalid")
))
))

View File

@@ -1,6 +1,6 @@
discard """
file: "tcgbug.nim"
output: '''success
output: '''
success
M1 M2
'''
"""
@@ -74,5 +74,5 @@ proc newMyObjectRef(kind: MyKind, val: string): MyObjectRef =
of M2: result.b = parseFloat(val)
of M3: result.c = val
echo newMyObject(M1, "2").kind, " ", newMyObjectRef(M2, "3").kind
echo newMyObject(M1, "2").kind, " ", newMyObjectRef(M2, "3").kind

View File

@@ -1,8 +1,7 @@
discard """
errormsg: "type mismatch"
file: "tconsttypemismatch.nim"
line: 7
errormsg: "type mismatch"
"""
# bug #2252
const foo: int = 1000 / 30

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "Expected a node of kind nnkCharLit, got nnkCommand"
file: "tmacroerrorproc.nim"
line: 13
errormsg: "Expected a node of kind nnkCharLit, got nnkCommand"
"""
# issue #4915
import macros

View File

@@ -1,6 +1,6 @@
discard """
line: 12
errormsg: "type mismatch: got <proc (x: int){.gcsafe, locks: 0.}>"
line: 12
"""
proc ugh[T](x: T) {.nimcall.} =

View File

@@ -1,6 +1,6 @@
discard """
line: 10
errormsg: "illegal capture 'A'"
line: 10
"""
proc outer() =

View File

@@ -1,6 +1,6 @@
discard """
line: 9
errormsg: "illegal capture 'x'"
line: 9
"""
proc outer(arg: string) =
@@ -9,4 +9,4 @@ proc outer(arg: string) =
echo "inner", x
inner()
outer("abc")
outer("abc")

View File

@@ -1,6 +1,5 @@
discard """
file: "tnested.nim"
output: '''
output: '''
foo88
23 24foo 88
foo88

View File

@@ -1,6 +1,5 @@
discard """
file: "tcnstseq.nim"
output: '''
output: '''
AngelikaAnneAnnaAnkaAnja
AngelikaAnneAnnaAnkaAnja
AngelikaAnneAnnaAnkaAnja

View File

@@ -1,7 +1,5 @@
discard """
file: "tcollections.nim"
output: '''
'''
output: ""
"""
import deques, sequtils

View File

@@ -1,6 +1,5 @@
discard """
file: "ttables.nim"
output: '''
output: '''
done
And we get here
1
@@ -142,7 +141,7 @@ block tindexby:
tbl2.add("bar", elem1)
tbl2.add("baz", elem2)
doAssert indexBy(@[elem1,elem2], proc(x: TElem): string = x.bar) == tbl2, "element table"
block tableconstr:
# Test if the new table constructor syntax works:

View File

@@ -1,6 +1,5 @@
discard """
file: "tconcepts.nim"
output: '''
output: '''
10
20
int
@@ -378,53 +377,53 @@ block tvectorspace:
block tstack:
template reject(e) =
static: assert(not compiles(e))
type
ArrayStack = object
data: seq[int]
proc push(s: var ArrayStack, item: int) =
s.data.add item
proc pop(s: var ArrayStack): int =
return s.data.pop()
type
Stack[T] = concept var s
s.push(T)
s.pop() is T
type ValueType = T
const ValueTypeName = T.name.toUpperAscii
proc genericAlgorithm[T](s: var Stack[T], y: T) =
static:
echo "INFERRED ", T.name
echo "VALUE TYPE ", s.ValueType.name
echo "VALUE TYPE NAME ", s.ValueTypeName
s.push(y)
echo s.pop
proc implicitGeneric(s: var Stack): auto =
static:
echo "IMPLICIT INFERRED ", s.T.name, " ", Stack.T.name
echo "IMPLICIT VALUE TYPE ", s.ValueType.name, " ", Stack.ValueType.name
echo "IMPLICIT VALUE TYPE NAME ", s.ValueTypeName, " ", Stack.ValueTypeName
return s.pop()
var s = ArrayStack(data: @[])
s.push 10
s.genericAlgorithm 20
echo s.implicitGeneric
reject s.genericAlgorithm "x"
reject s.genericAlgorithm 1.0
reject "str".implicitGeneric
reject implicitGeneric(10)
import libs/[trie_database, trie]

View File

@@ -63,8 +63,8 @@ texplain.nim(92, 5) NestedConcept: concept predicate failed
expression: f(y)
'''
line: 138
errormsg: "type mismatch: got <MatchingType>"
line: 138
"""
@@ -136,4 +136,3 @@ static:
# finally, provide multiple nested explanations for failed matching
# of regular concepts, even when the explain pragma is not used
f(y)

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "type mismatch"
file: "tconstr1.nim"
line: 25
errormsg: "type mismatch"
"""
# Test array, record constructors
@@ -26,5 +26,3 @@ 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'})]

View File

@@ -1,5 +1,4 @@
discard """
file: "tconstr2.nim"
output: "69"
"""
# Test array, record constructors
@@ -21,6 +20,3 @@ const
write(stdout, things[0].x)
#OUT 69

View File

@@ -1,6 +1,6 @@
discard """
line: 16
errormsg: "type mismatch: got <int literal(232)>"
line: 16
"""
proc myGenericProc[T: object|tuple|ptr|ref|distinct](x: T): string =
@@ -14,5 +14,3 @@ var
assert myGenericProc(x) == "(x: 0, y: 0)"
assert myGenericProc(232) == "232"

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "incorrect object construction syntax"
file: "t5965_1.nim"
line: 10
errormsg: "incorrect object construction syntax"
"""
type Foo = object

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "incorrect object construction syntax"
file: "t5965_2.nim"
line: 10
errormsg: "incorrect object construction syntax"
"""
type Foo = object

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "undeclared identifier: \'ha\'"
file: "tblock1.nim"
line: 14
errormsg: "undeclared identifier: \'ha\'"
"""
# check for forward label and
# for failure when label is not declared
@@ -14,5 +14,3 @@ proc main =
break ha #ERROR
main()

View File

@@ -1,12 +1,9 @@
discard """
errormsg: "unreachable statement after 'return' statement or '{.noReturn.}' proc"
file: "tstatret.nim"
line: 9
errormsg: "unreachable statement after 'return' statement or '{.noReturn.}' proc"
"""
# no statement after return
proc main() =
return
echo("huch?") #ERROR_MSG statement not allowed after

View File

@@ -1,6 +1,5 @@
discard """
file: "tconverter_unique_ptr.nim"
targets: "c cpp"
output: ""
"""
@@ -34,7 +33,7 @@ proc `=`*(m: var MySeq, m2: MySeq) =
`=destroy`(m)
m.len = m2.len
let bytes = m.len.int * sizeof(float)
let bytes = m.len.int * sizeof(float)
if bytes > 0:
m.data = cast[ptr UncheckedArray[float]](allocShared(bytes))
copyMem(m.data, m2.data, bytes)
@@ -59,7 +58,7 @@ proc `[]`*(m: var MySeq; i: MyLen): var float {.inline.} =
proc `[]=`*(m: var MySeq; i: MyLen, val: float) {.inline.} =
m.data[i.int] = val
proc setTo(s: var MySeq, val: float) =
proc setTo(s: var MySeq, val: float) =
for i in 0..<s.len.int:
s.data[i] = val
@@ -112,7 +111,7 @@ doAssert pu[0] == 2.0
doAssert: pu2[0] == 2.0
##-----------------------------------------------------------------------------------------
## Bugs #9735 and #9736
## Bugs #9735 and #9736
type
ConstPtr*[T] = object
## This pointer makes it impossible to change underlying value

View File

@@ -1,8 +1,8 @@
discard """
errormsg: "type mismatch: got <int>"
file: "tconverter_with_constraint.nim"
line: 20
errormsg: "type mismatch: got <int>"
"""
type
@@ -10,11 +10,11 @@ type
converter to_mytype(m: int{lit}): MyType =
m.MyType
proc myproc(m: MyType) =
echo m.int, ".MyType"
myproc(1) # call by literal is ok
myproc(1) # call by literal is ok
var x: int = 12
myproc(x) # should fail
myproc(x) # should fail

View File

@@ -1,6 +1,6 @@
discard """
line: 7
errormsg: "annotation to deprecated not supported here"
line: 7
"""
var foo* {.deprecated.} = 42

View File

@@ -1,6 +1,6 @@
discard """
line: 9
errormsg: "illegal discard"
line: 9
"""
proc pop[T](arg: T): T =

View File

@@ -1,6 +1,6 @@
discard """
line: 10
errormsg: '''expression 'open(f, "arg.txt", fmRead, -1)' is of type 'bool' and has to be discarded; start of expression here: tneedsdiscard.nim(7, 2)'''
line: 10
"""
proc p =

View File

@@ -1,6 +1,6 @@
discard """
line: 22
errormsg: '''expression 'premultiply(app.gradient[i])' is of type 'Rgba8' and has to be discarded'''
line: 22
"""
# bug #9076

View File

@@ -1,6 +1,6 @@
discard """
file: "tnil.nim"
output: '''1
output: '''
1
0
0
'''

View File

@@ -1,6 +1,6 @@
discard """
file: "system.nim"
errormsg: "can raise an unlisted exception: ref IOError"
file: "system.nim"
"""
type
@@ -17,4 +17,3 @@ proc lier(): int {.raises: [IO2Error].} =
proc forw: int =
raise newException(IOError, "arg")

View File

@@ -1,6 +1,6 @@
discard """
line: 19
errormsg: "can raise an unlisted exception: ref IOError"
line: 19
"""
type
@@ -17,4 +17,3 @@ proc lier(): int {.raises: [IOError].} =
proc forw: int =
raise newException(IOError, "arg")

View File

@@ -1,6 +1,6 @@
discard """
line: 18
errormsg: "type mismatch"
line: 18
"""
type
@@ -16,4 +16,3 @@ proc raiser(): int {.tags: [TObj, WriteIoEffect].} =
var o: TObjB
o.fn = raiser

View File

@@ -1,6 +1,6 @@
discard """
line: 23
errormsg: "type mismatch"
line: 23
"""
type
@@ -21,4 +21,3 @@ proc raiser(): int =
var o: TObjB
o.fn = raiser

View File

@@ -1,6 +1,6 @@
discard """
line: 17
errormsg: "'mainUnsafe' is not GC-safe"
line: 17
cmd: "nim $target --hints:on --threads:on $options $file"
"""

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "\'SideEffectLyer\' can have side effects"
file: "tsidee1.nim"
line: 12
errormsg: "\'SideEffectLyer\' can have side effects"
"""
var
@@ -13,6 +13,3 @@ proc SideEffectLyer(x, y: int): int {.noSideEffect.} = #ERROR_MSG 'SideEffectLye
return x + y + dontcare(x)
echo SideEffectLyer(1, 3)

View File

@@ -1,5 +1,4 @@
discard """
file: "tsidee2.nim"
output: "5"
"""
@@ -12,6 +11,3 @@ proc SideEffectLyer(x, y: int): int {.noSideEffect.} =
return x + y + dontcare(x)
echo SideEffectLyer(1, 3) #OUT 5

View File

@@ -1,5 +1,4 @@
discard """
file: "tsidee3.nim"
output: "5"
"""
@@ -12,6 +11,3 @@ proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSi
return x + y + dontcare(x)
echo noSideEffect(1, 3, dontcare) #OUT 5

View File

@@ -1,7 +1,7 @@
discard """
errormsg: "'noSideEffect' can have side effects"
file: "tsidee4.nim"
line: 12
errormsg: "'noSideEffect' can have side effects"
"""
var
@@ -13,5 +13,3 @@ 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

View File

@@ -1,9 +1,7 @@
discard """
line: 7
errormsg: "attempting to call routine: 'items'"
line: 7
"""
type a = enum b,c,d
a.items()

View File

@@ -1,6 +1,6 @@
discard """
line: 8
errormsg: "type mismatch: got <seq[int]> but expected 'seq[float]'"
line: 8
"""
import sequtils

View File

@@ -1,5 +1,4 @@
discard """
file: "tcontinuexc.nim"
outputsub: "ECcaught"
exitcode: "1"
"""
@@ -25,6 +24,3 @@ finally:
echo "caught"
#OUT ECcaught

View File

@@ -1,5 +1,4 @@
discard """
file: "tnestedbreak.nim"
output: "1\n2\n3\n4"
"""

View File

@@ -1,5 +1,4 @@
discard """
file: "texcsub.nim"
output: "caught!"
"""
# Test inheritance for exception matching:
@@ -12,6 +11,3 @@ except:
echo "wtf!?"
#OUT caught!

View File

@@ -1,6 +1,6 @@
discard """
file: "tfinally.nim"
output: '''came
output: '''
came
here
3
msg1
@@ -59,4 +59,4 @@ try:
except:
echo "except2"
finally:
echo "finally2"
echo "finally2"

View File

@@ -1,9 +1,10 @@
discard """
file: "tfinally2.nim"
output: '''A
output: '''
A
B
C
D'''
D
'''
"""
# Test break in try statement:
@@ -24,7 +25,4 @@ proc main: int =
finally:
echo("D")
discard main() #OUT ABCD
discard main()

View File

@@ -1,7 +1,8 @@
discard """
file: "tfinally3.nim"
outputsub: '''false
Within finally->try'''
outputsub: '''
false
Within finally->try
'''
exitCode: 1
"""
# Test break in try statement:

View File

@@ -1,5 +1,4 @@
discard """
file: "tfinally4.nim"
output: "B1\nA1\n1\nB1\nB2\ncatch\nA1\n1\nB1\nA1\nA2\n2\nB1\nB2\ncatch\nA1\nA2\n0\nB1\nA1\n1\nB1\nB2\nA1\n1\nB1\nA1\nA2\n2\nB1\nB2\nA1\nA2\n3"
"""

View File

@@ -1,6 +1,5 @@
discard """
targets: "c cpp"
file: "tnestedreturn.nim"
output: "A\nB\nC\n"
"""

View File

@@ -1,5 +1,4 @@
discard """
file: "tnestedreturn2.nim"
outputsub: "Error: unhandled exception: Problem [OSError]"
exitcode: "1"
"""

View File

@@ -1,5 +1,4 @@
discard """
file: "treraise.nim"
outputsub: "Error: unhandled exception: bla [ESomeOtherErr]"
exitcode: "1"
"""
@@ -19,6 +18,3 @@ except ESomething:
echo("Error happened")
except:
raise

View File

@@ -1,7 +1,6 @@
discard """
file: "tunhandledexc.nim"
cmd: "nim $target -d:release $options $file"
outputsub: '''tunhandledexc.nim(16) genErrors
outputsub: '''tunhandledexc.nim(15) genErrors
Error: unhandled exception: bla [ESomeOtherErr]'''
exitcode: "1"
"""

View File

@@ -1,5 +1,4 @@
discard """
file: "twrongexc.nim"
outputsub: "Error: unhandled exception: [ValueError]"
exitcode: "1"
"""
@@ -7,7 +6,3 @@ try:
raise newException(ValueError, "")
except OverflowError:
echo("Error caught")

View File

@@ -1,6 +1,6 @@
discard """
line: 10
errormsg: "expression 'result[1 .. BackwardsIndex(1)]' is of type 'string' and has to be discarded"
line: 10
"""
# bug #578

View File

@@ -1,9 +1,8 @@
discard """
errormsg: "expression '5' is of type 'int literal(5)' and has to be discarded"
file: "tstmtexp.nim"
line: 8
errormsg: "expression '5' is of type 'int literal(5)' and has to be discarded"
"""
# Test 3
1+4

View File

@@ -1,5 +1,4 @@
discard """
file: "tgenscript.nim"
target: "c"
action: compile
"""

View File

@@ -1,5 +1,4 @@
discard """
file: "tfloat1.nim"
outputsub: "Error: unhandled exception: FPU operation caused an overflow [FloatOverflowError]"
exitcode: "1"
"""
@@ -11,5 +10,3 @@ var x = 0.8
var y = 0.0
echo x / y #OUT Error: unhandled exception: FPU operation caused an overflow

View File

@@ -1,5 +1,4 @@
discard """
file: "tfloat2.nim"
outputsub: "Error: unhandled exception: FPU operation caused a NaN result [FloatInvalidOpError]"
exitcode: "1"
"""
@@ -11,5 +10,3 @@ var x = 0.0
var y = 0.0
echo x / y #OUT Error: unhandled exception: FPU operation caused a NaN result

View File

@@ -1,5 +1,4 @@
discard """
file: "tfloat3.nim"
output: "Nim 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698"
"""
@@ -19,6 +18,3 @@ proc printFloats {.importc, nodecl.}
var x: float = 1.234567890123456789
c_printf("Nim %.10f, %.10f ", exp(x), cos(x))
printFloats()

View File

@@ -1,8 +1,7 @@
discard """
file: "tfloat4.nim"
output: "passed all tests."
exitcode: 0
"""
import math, strutils
proc c_sprintf(buf, fmt: cstring) {.importc:"sprintf", header: "<stdio.h>", varargs.}

View File

@@ -1,9 +1,10 @@
discard """
file: "tfloat5.nim"
output: '''0 : 0.0
output: '''
0 : 0.0
0 : 0.0
0 : 0.0'''
0 : 0.0
0 : 0.0
'''
"""
import parseutils

View File

@@ -1,12 +1,13 @@
discard """
file: "tfloat6.nim"
output: '''1e-06 : 1e-06
output: '''
1e-06 : 1e-06
1e-06 : 1e-06
0.001 : 0.001
1e-06 : 1e-06
1e-06 : 1e-06
10.000001 : 10.000001
100.000001 : 100.000001'''
100.000001 : 100.000001
'''
disabled: "windows"
"""

View File

@@ -1,12 +1,13 @@
discard """
file: "tfloat6.nim"
output: '''passed.
output: '''
passed.
passed.
passed.
passed.
passed.
passed.'''
passed.
passed.
'''
"""
import strutils

Some files were not shown because too many files have changed in this diff Show More