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

View file

@ -143,10 +143,16 @@ proc parseSpec*(filename: string): TSpec =
else: else:
result.parseErrors.addLine "cannot interpret as action: ", e.value result.parseErrors.addLine "cannot interpret as action: ", e.value
of "file": 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 result.file = e.value
of "line": 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) discard parseInt(e.value, result.line)
of "column": 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) discard parseInt(e.value, result.column)
of "tfile": of "tfile":
result.tfile = e.value result.tfile = e.value

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,3 @@
discard """
file: "t7758.nim"
exitcode: 0
"""
import asyncdispatch import asyncdispatch
proc task() {.async.} = proc task() {.async.} =

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,5 @@
discard """ discard """
file: "tfuturestream.nim" output: '''
exitcode: 0
output: '''
0 0
1 1
2 2

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,13 +1,17 @@
discard """ discard """
errormsg: "type mismatch: got <string> but expected 'int'"
line: 33
file: "tcaseexpr1.nim" file: "tcaseexpr1.nim"
line: 29
errormsg: "type mismatch: got <string> but expected 'int'"
line: 23
errormsg: "not all cases are covered" 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 type
E = enum A, B, C E = enum A, B, C
@ -27,4 +31,3 @@ var t1 = case x:
var t2 = case x: var t2 = case x:
of A: 10 of A: 10
of B, C: "23" of B, C: "23"

View file

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

View file

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

View file

@ -1,6 +1,5 @@
discard """ discard """
file: "tcasestmt.nim" output:
output:
''' '''
Not found! Not found!
Found! Found!

View file

@ -1,6 +1,6 @@
discard """ discard """
file: "tcgbug.nim" output: '''
output: '''success success
M1 M2 M1 M2
''' '''
""" """

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
discard """ discard """
file: "ttables.nim" output: '''
output: '''
done done
And we get here And we get here
1 1

View file

@ -1,6 +1,5 @@
discard """ discard """
file: "tconcepts.nim" output: '''
output: '''
10 10
20 20
int int

View file

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

View file

@ -1,7 +1,7 @@
discard """ discard """
errormsg: "type mismatch"
file: "tconstr1.nim" file: "tconstr1.nim"
line: 25 line: 25
errormsg: "type mismatch"
""" """
# Test array, record constructors # Test array, record constructors
@ -26,5 +26,3 @@ const
otherThings = [ # the same otherThings = [ # the same
(s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}),
(s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})] (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,5 @@
discard """ discard """
file: "tconverter_unique_ptr.nim"
targets: "c cpp" targets: "c cpp"
output: "" output: ""
""" """

View file

@ -1,8 +1,8 @@
discard """ discard """
errormsg: "type mismatch: got <int>"
file: "tconverter_with_constraint.nim" file: "tconverter_with_constraint.nim"
line: 20 line: 20
errormsg: "type mismatch: got <int>"
""" """
type type

View file

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

View file

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

View file

@ -1,6 +1,6 @@
discard """ 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)''' 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 = proc p =

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
discard """ discard """
errormsg: "'noSideEffect' can have side effects"
file: "tsidee4.nim" file: "tsidee4.nim"
line: 12 line: 12
errormsg: "'noSideEffect' can have side effects"
""" """
var var
@ -13,5 +13,3 @@ proc noSideEffect(x, y: int, p: proc (a: int): int {.noSideEffect.}): int {.noSi
return x + y + dontcare(x) return x + y + dontcare(x)
echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch echo noSideEffect(1, 3, dontcare) #ERROR_MSG type mismatch

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
discard """ discard """
file: "tfinally.nim" output: '''
output: '''came came
here here
3 3
msg1 msg1

View file

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

View file

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

View file

@ -1,5 +1,4 @@
discard """ 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" 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 """ discard """
targets: "c cpp" targets: "c cpp"
file: "tnestedreturn.nim"
output: "A\nB\nC\n" output: "A\nB\nC\n"
""" """

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,4 @@
discard """ discard """
file: "tfloat3.nim"
output: "Nim 3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698" 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 var x: float = 1.234567890123456789
c_printf("Nim %.10f, %.10f ", exp(x), cos(x)) c_printf("Nim %.10f, %.10f ", exp(x), cos(x))
printFloats() printFloats()

View file

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

View file

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

View file

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

View file

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

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