require errormsg to be specified before file.
This commit is contained in:
parent
ca394ebd95
commit
1105d03644
264 changed files with 305 additions and 623 deletions
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tarray.nim"
|
output: '''
|
||||||
output:
|
|
||||||
'''
|
|
||||||
[4, 5, 6]
|
[4, 5, 6]
|
||||||
|
|
||||||
[16, 25, 36]
|
[16, 25, 36]
|
||||||
|
|
|
||||||
|
|
@ -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]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tassign.nim"
|
|
||||||
output:
|
output:
|
||||||
'''
|
'''
|
||||||
TEMP=C:\Programs\xyz\bin
|
TEMP=C:\Programs\xyz\bin
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
discard """
|
|
||||||
file: "t7758.nim"
|
|
||||||
exitcode: 0
|
|
||||||
"""
|
|
||||||
import asyncdispatch
|
import asyncdispatch
|
||||||
|
|
||||||
proc task() {.async.} =
|
proc task() {.async.} =
|
||||||
|
|
@ -16,4 +12,4 @@ proc main() =
|
||||||
|
|
||||||
doAssert counter <= 4
|
doAssert counter <= 4
|
||||||
|
|
||||||
for i in 0 .. 10: main()
|
for i in 0 .. 10: main()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncRecvLine.nim"
|
output: '''
|
||||||
output: '''
|
|
||||||
Hello World
|
Hello World
|
||||||
Hello World
|
Hello World
|
||||||
'''
|
'''
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncall.nim"
|
|
||||||
exitcode: 0
|
exitcode: 0
|
||||||
"""
|
"""
|
||||||
import times, sequtils
|
import times, sequtils
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncdial.nim"
|
|
||||||
output: '''
|
output: '''
|
||||||
OK AF_INET
|
OK AF_INET
|
||||||
OK AF_INET6
|
OK AF_INET6
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncrecursion.nim"
|
output: "50005000"
|
||||||
output: "50005000"
|
|
||||||
"""
|
"""
|
||||||
import asyncdispatch
|
import asyncdispatch
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncsend4754.nim"
|
output: "Finished"
|
||||||
output: "Finished"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncdispatch, asyncnet
|
import asyncdispatch, asyncnet
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tfuturestream.nim"
|
output: '''
|
||||||
exitcode: 0
|
|
||||||
output: '''
|
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
|
|
@ -70,4 +68,4 @@ waitFor testCompletion()
|
||||||
|
|
||||||
# echo("Finished")
|
# echo("Finished")
|
||||||
|
|
||||||
# waitFor omega()
|
# waitFor omega()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tioselectors.nim"
|
|
||||||
output: "All tests passed!"
|
output: "All tests passed!"
|
||||||
"""
|
"""
|
||||||
import selectors
|
import selectors
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "twinasyncrw.nim"
|
|
||||||
output: "5000"
|
output: "5000"
|
||||||
"""
|
"""
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tbind.nim"
|
output: '''
|
||||||
output:
|
|
||||||
'''
|
|
||||||
3
|
3
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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) )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
line: 13
|
|
||||||
errormsg: "duplicate case label"
|
errormsg: "duplicate case label"
|
||||||
|
line: 13
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
line: 13
|
|
||||||
errormsg: "duplicate case label"
|
errormsg: "duplicate case label"
|
||||||
|
line: 13
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tcasestmt.nim"
|
output:
|
||||||
output:
|
|
||||||
'''
|
'''
|
||||||
Not found!
|
Not found!
|
||||||
Found!
|
Found!
|
||||||
|
|
@ -226,4 +225,4 @@ block tcasestm:
|
||||||
"invalid Y".quit(3)
|
"invalid Y".quit(3)
|
||||||
true
|
true
|
||||||
else: raise newException(ValueError, "Invalid")
|
else: raise newException(ValueError, "Invalid")
|
||||||
))
|
))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tcgbug.nim"
|
output: '''
|
||||||
output: '''success
|
success
|
||||||
M1 M2
|
M1 M2
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
@ -74,5 +74,5 @@ proc newMyObjectRef(kind: MyKind, val: string): MyObjectRef =
|
||||||
of M2: result.b = parseFloat(val)
|
of M2: result.b = parseFloat(val)
|
||||||
of M3: result.c = val
|
of M3: result.c = val
|
||||||
|
|
||||||
|
|
||||||
echo newMyObject(M1, "2").kind, " ", newMyObjectRef(M2, "3").kind
|
echo newMyObject(M1, "2").kind, " ", newMyObjectRef(M2, "3").kind
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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.} =
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
line: 10
|
|
||||||
errormsg: "illegal capture 'A'"
|
errormsg: "illegal capture 'A'"
|
||||||
|
line: 10
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc outer() =
|
proc outer() =
|
||||||
|
|
|
||||||
|
|
@ -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) =
|
||||||
|
|
@ -9,4 +9,4 @@ proc outer(arg: string) =
|
||||||
echo "inner", x
|
echo "inner", x
|
||||||
inner()
|
inner()
|
||||||
|
|
||||||
outer("abc")
|
outer("abc")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tnested.nim"
|
output: '''
|
||||||
output: '''
|
|
||||||
foo88
|
foo88
|
||||||
23 24foo 88
|
23 24foo 88
|
||||||
foo88
|
foo88
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tcnstseq.nim"
|
output: '''
|
||||||
output: '''
|
|
||||||
AngelikaAnneAnnaAnkaAnja
|
AngelikaAnneAnnaAnkaAnja
|
||||||
AngelikaAnneAnnaAnkaAnja
|
AngelikaAnneAnnaAnkaAnja
|
||||||
AngelikaAnneAnnaAnkaAnja
|
AngelikaAnneAnnaAnkaAnja
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tcollections.nim"
|
output: ""
|
||||||
output: '''
|
|
||||||
'''
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import deques, sequtils
|
import deques, sequtils
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "ttables.nim"
|
output: '''
|
||||||
output: '''
|
|
||||||
done
|
done
|
||||||
And we get here
|
And we get here
|
||||||
1
|
1
|
||||||
|
|
@ -142,7 +141,7 @@ block tindexby:
|
||||||
tbl2.add("bar", elem1)
|
tbl2.add("bar", elem1)
|
||||||
tbl2.add("baz", elem2)
|
tbl2.add("baz", elem2)
|
||||||
doAssert indexBy(@[elem1,elem2], proc(x: TElem): string = x.bar) == tbl2, "element table"
|
doAssert indexBy(@[elem1,elem2], proc(x: TElem): string = x.bar) == tbl2, "element table"
|
||||||
|
|
||||||
|
|
||||||
block tableconstr:
|
block tableconstr:
|
||||||
# Test if the new table constructor syntax works:
|
# Test if the new table constructor syntax works:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tconcepts.nim"
|
output: '''
|
||||||
output: '''
|
|
||||||
10
|
10
|
||||||
20
|
20
|
||||||
int
|
int
|
||||||
|
|
@ -378,53 +377,53 @@ block tvectorspace:
|
||||||
block tstack:
|
block tstack:
|
||||||
template reject(e) =
|
template reject(e) =
|
||||||
static: assert(not compiles(e))
|
static: assert(not compiles(e))
|
||||||
|
|
||||||
type
|
type
|
||||||
ArrayStack = object
|
ArrayStack = object
|
||||||
data: seq[int]
|
data: seq[int]
|
||||||
|
|
||||||
proc push(s: var ArrayStack, item: int) =
|
proc push(s: var ArrayStack, item: int) =
|
||||||
s.data.add item
|
s.data.add item
|
||||||
|
|
||||||
proc pop(s: var ArrayStack): int =
|
proc pop(s: var ArrayStack): int =
|
||||||
return s.data.pop()
|
return s.data.pop()
|
||||||
|
|
||||||
type
|
type
|
||||||
Stack[T] = concept var s
|
Stack[T] = concept var s
|
||||||
s.push(T)
|
s.push(T)
|
||||||
s.pop() is T
|
s.pop() is T
|
||||||
|
|
||||||
type ValueType = T
|
type ValueType = T
|
||||||
const ValueTypeName = T.name.toUpperAscii
|
const ValueTypeName = T.name.toUpperAscii
|
||||||
|
|
||||||
proc genericAlgorithm[T](s: var Stack[T], y: T) =
|
proc genericAlgorithm[T](s: var Stack[T], y: T) =
|
||||||
static:
|
static:
|
||||||
echo "INFERRED ", T.name
|
echo "INFERRED ", T.name
|
||||||
echo "VALUE TYPE ", s.ValueType.name
|
echo "VALUE TYPE ", s.ValueType.name
|
||||||
echo "VALUE TYPE NAME ", s.ValueTypeName
|
echo "VALUE TYPE NAME ", s.ValueTypeName
|
||||||
|
|
||||||
s.push(y)
|
s.push(y)
|
||||||
echo s.pop
|
echo s.pop
|
||||||
|
|
||||||
proc implicitGeneric(s: var Stack): auto =
|
proc implicitGeneric(s: var Stack): auto =
|
||||||
static:
|
static:
|
||||||
echo "IMPLICIT INFERRED ", s.T.name, " ", Stack.T.name
|
echo "IMPLICIT INFERRED ", s.T.name, " ", Stack.T.name
|
||||||
echo "IMPLICIT VALUE TYPE ", s.ValueType.name, " ", Stack.ValueType.name
|
echo "IMPLICIT VALUE TYPE ", s.ValueType.name, " ", Stack.ValueType.name
|
||||||
echo "IMPLICIT VALUE TYPE NAME ", s.ValueTypeName, " ", Stack.ValueTypeName
|
echo "IMPLICIT VALUE TYPE NAME ", s.ValueTypeName, " ", Stack.ValueTypeName
|
||||||
|
|
||||||
return s.pop()
|
return s.pop()
|
||||||
|
|
||||||
var s = ArrayStack(data: @[])
|
var s = ArrayStack(data: @[])
|
||||||
|
|
||||||
s.push 10
|
s.push 10
|
||||||
s.genericAlgorithm 20
|
s.genericAlgorithm 20
|
||||||
echo s.implicitGeneric
|
echo s.implicitGeneric
|
||||||
|
|
||||||
reject s.genericAlgorithm "x"
|
reject s.genericAlgorithm "x"
|
||||||
reject s.genericAlgorithm 1.0
|
reject s.genericAlgorithm 1.0
|
||||||
reject "str".implicitGeneric
|
reject "str".implicitGeneric
|
||||||
reject implicitGeneric(10)
|
reject implicitGeneric(10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import libs/[trie_database, trie]
|
import libs/[trie_database, trie]
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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'})]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
discard """
|
discard """
|
||||||
file: "tconverter_unique_ptr.nim"
|
|
||||||
targets: "c cpp"
|
targets: "c cpp"
|
||||||
output: ""
|
output: ""
|
||||||
"""
|
"""
|
||||||
|
|
@ -34,7 +33,7 @@ proc `=`*(m: var MySeq, m2: MySeq) =
|
||||||
`=destroy`(m)
|
`=destroy`(m)
|
||||||
|
|
||||||
m.len = m2.len
|
m.len = m2.len
|
||||||
let bytes = m.len.int * sizeof(float)
|
let bytes = m.len.int * sizeof(float)
|
||||||
if bytes > 0:
|
if bytes > 0:
|
||||||
m.data = cast[ptr UncheckedArray[float]](allocShared(bytes))
|
m.data = cast[ptr UncheckedArray[float]](allocShared(bytes))
|
||||||
copyMem(m.data, m2.data, 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.} =
|
proc `[]=`*(m: var MySeq; i: MyLen, val: float) {.inline.} =
|
||||||
m.data[i.int] = val
|
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:
|
for i in 0..<s.len.int:
|
||||||
s.data[i] = val
|
s.data[i] = val
|
||||||
|
|
||||||
|
|
@ -112,7 +111,7 @@ doAssert pu[0] == 2.0
|
||||||
doAssert: pu2[0] == 2.0
|
doAssert: pu2[0] == 2.0
|
||||||
|
|
||||||
##-----------------------------------------------------------------------------------------
|
##-----------------------------------------------------------------------------------------
|
||||||
## Bugs #9735 and #9736
|
## Bugs #9735 and #9736
|
||||||
type
|
type
|
||||||
ConstPtr*[T] = object
|
ConstPtr*[T] = object
|
||||||
## This pointer makes it impossible to change underlying value
|
## This pointer makes it impossible to change underlying value
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -10,11 +10,11 @@ type
|
||||||
|
|
||||||
converter to_mytype(m: int{lit}): MyType =
|
converter to_mytype(m: int{lit}): MyType =
|
||||||
m.MyType
|
m.MyType
|
||||||
|
|
||||||
proc myproc(m: MyType) =
|
proc myproc(m: MyType) =
|
||||||
echo m.int, ".MyType"
|
echo m.int, ".MyType"
|
||||||
|
|
||||||
myproc(1) # call by literal is ok
|
myproc(1) # call by literal is ok
|
||||||
|
|
||||||
var x: int = 12
|
var x: int = 12
|
||||||
myproc(x) # should fail
|
myproc(x) # should fail
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 =
|
||||||
|
|
|
||||||
|
|
@ -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 =
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tnil.nim"
|
output: '''
|
||||||
output: '''1
|
1
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
'''
|
'''
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tnestedbreak.nim"
|
|
||||||
output: "1\n2\n3\n4"
|
output: "1\n2\n3\n4"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tfinally.nim"
|
output: '''
|
||||||
output: '''came
|
came
|
||||||
here
|
here
|
||||||
3
|
3
|
||||||
msg1
|
msg1
|
||||||
|
|
@ -59,4 +59,4 @@ try:
|
||||||
except:
|
except:
|
||||||
echo "except2"
|
echo "except2"
|
||||||
finally:
|
finally:
|
||||||
echo "finally2"
|
echo "finally2"
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tgenscript.nim"
|
|
||||||
target: "c"
|
target: "c"
|
||||||
action: compile
|
action: compile
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
Loading…
Add table
Add a link
Reference in a new issue