diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/core/macros.nim | 2 | ||||
-rwxr-xr-x | lib/impure/graphics.nim | 2 | ||||
-rwxr-xr-x | lib/pure/sockets.nim | 2 | ||||
-rw-r--r-- | lib/pure/unittest.nim | 11 |
4 files changed, 8 insertions, 9 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 8fdaf7a6c..c30474b70 100755 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -38,7 +38,7 @@ type nnkFastAsgn, nnkGenericParams, nnkFormalParams, nnkOfInherit, nnkModule, nnkProcDef, nnkMethodDef, nnkConverterDef, nnkMacroDef, nnkTemplateDef, nnkIteratorDef, nnkOfBranch, - nnkElifBranch, nnkExceptBranch, nnkElse, nnkMacroStmt, + nnkElifBranch, nnkExceptBranch, nnkElse, nnkAsmStmt, nnkPragma, nnkPragmaBlock, nnkIfStmt, nnkWhenStmt, nnkForStmt, nnkParForStmt, nnkWhileStmt, nnkCaseStmt, nnkTypeSection, nnkVarSection, nnkLetSection, nnkConstSection, diff --git a/lib/impure/graphics.nim b/lib/impure/graphics.nim index 1d538b790..b3bc578d0 100755 --- a/lib/impure/graphics.nim +++ b/lib/impure/graphics.nim @@ -22,7 +22,7 @@ type PSurface* = ref TSurface ## a surface to draw onto TSurface* {.pure, final.} = object - w*, h*: int + w*, h*: Natural s*: sdl.PSurface EGraphics* = object of EIO diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim index fb04d6754..4782ddd2e 100755 --- a/lib/pure/sockets.nim +++ b/lib/pure/sockets.nim @@ -940,7 +940,7 @@ proc readIntoBuf(socket: TSocket, flags: int32): int = socket.currPos = 0 template retRead(flags, readBytes: int) = - let res = socket.readIntoBuf(flags) + let res = socket.readIntoBuf(flags.int32) if res <= 0: if readBytes > 0: return readBytes diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 0233b8bac..fce84bea4 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -151,7 +151,7 @@ template require*(conditions: stmt): stmt {.immediate, dirty.} = const AbortOnError {.inject.} = true check conditions -macro expect*(exp: stmt): stmt {.immediate.} = +macro expect*(exceptions: varargs[expr], body: stmt): stmt {.immediate.} = let exp = callsite() template expectBody(errorTypes, lineInfoLit: expr, body: stmt): PNimrodNode {.dirty.} = @@ -162,12 +162,11 @@ macro expect*(exp: stmt): stmt {.immediate.} = except errorTypes: nil - var expectCall = exp[0] - var body = exp[1] - + var body = exp[exp.len - 1] + var errorTypes = newNimNode(nnkBracket) - for i in countup(1, expectCall.len - 1): - errorTypes.add(expectCall[i]) + for i in countup(1, exp.len - 2): + errorTypes.add(exp[i]) result = getAst(expectBody(errorTypes, exp.lineinfo, body)) |