fix some trivial errors in the test suite and some more regressions caused by tyTypeDesc[tyNone]
This commit is contained in:
parent
4d3846e26b
commit
cda92048ba
10 changed files with 68 additions and 37 deletions
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
output: "10\n10"
|
||||
output: "10\n10\n1\n2\n3"
|
||||
"""
|
||||
|
||||
proc test(x: proc (a, b: int): int) =
|
||||
|
|
@ -8,3 +8,11 @@ proc test(x: proc (a, b: int): int) =
|
|||
test(proc (a, b): auto = a + b)
|
||||
|
||||
test do (a, b) -> auto: a + b
|
||||
|
||||
proc foreach[T](s: seq[T], body: proc(x: T)) =
|
||||
for e in s:
|
||||
body(e)
|
||||
|
||||
foreach(@[1,2,3]) do (x):
|
||||
echo x
|
||||
|
||||
|
|
|
|||
15
tests/global/globalaux.nim
Normal file
15
tests/global/globalaux.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
type
|
||||
TObj*[T] = object
|
||||
val*: T
|
||||
|
||||
var
|
||||
totalGlobals* = 0
|
||||
|
||||
proc makeObj[T](x: T): TObj[T] =
|
||||
totalGlobals += 1
|
||||
result.val = x
|
||||
|
||||
proc globalInstance*[T]: var TObj[T] =
|
||||
var g {.global.} = when T is int: makeObj(10) else: makeObj("hello")
|
||||
result = g
|
||||
|
||||
4
tests/global/globalaux2.nim
Normal file
4
tests/global/globalaux2.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import globalaux
|
||||
|
||||
echo "in globalaux2: ", globalInstance[int]().val
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
file: "tests/reject/trecincb.nim"
|
||||
line: 9
|
||||
errormsg: "recursive dependency: 'tests/reject/trecincb.nim'"
|
||||
errormsg: "recursive dependency: 'tests/module/trecincb.nim'"
|
||||
"""
|
||||
# Test recursive includes
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
file: "trecincb.nim"
|
||||
line: 9
|
||||
errormsg: "recursive dependency: 'tests/reject/trecincb.nim'"
|
||||
errormsg: "recursive dependency: 'tests/module/trecincb.nim'"
|
||||
"""
|
||||
# Test recursive includes
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ type
|
|||
channel: string
|
||||
timestamp: TTime
|
||||
case kind*: TSeenType
|
||||
of PSeenJoin: discard
|
||||
of PSeenJoin: nil
|
||||
of PSeenPart, PSeenQuit, PSeenMsg:
|
||||
msg: string
|
||||
of PSeenNick:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
discard """
|
||||
output: "he, no return type;abc a string"
|
||||
output: '''12
|
||||
empty
|
||||
he, no return type;
|
||||
abc a string
|
||||
ha'''
|
||||
"""
|
||||
|
||||
proc ReturnT[T](x: T): T =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue