diff options
author | Araq <rumpf_a@web.de> | 2014-01-18 00:58:59 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-01-18 00:58:59 +0100 |
commit | 5073914b8697a9fd1dc38bebef434b50850f2861 (patch) | |
tree | 13fb2aaae8491773a0d0c04f3989b72e3efbecf5 /lib/pure | |
parent | 383fbca27ef4f4e0b5eae0e0e02029fe644248ac (diff) | |
download | Nim-5073914b8697a9fd1dc38bebef434b50850f2861.tar.gz |
unittest module works again
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/unittest.nim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index f847d24f4..f5640a1b4 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -37,8 +37,8 @@ var checkpoints: seq[string] = @[] -template TestSetupIMPL*: stmt {.immediate, dirty.} = nil -template TestTeardownIMPL*: stmt {.immediate, dirty.} = nil +template TestSetupIMPL*: stmt {.immediate, dirty.} = discard +template TestTeardownIMPL*: stmt {.immediate, dirty.} = discard proc shouldRun(testName: string): bool = result = true @@ -126,7 +126,7 @@ macro check*(conditions: stmt): stmt {.immediate.} = for i in 1 .. <exp.len: if exp[i].kind notin nnkLiterals: inc counter - var arg = newIdentNode(":p" & ($counter)) + var arg = newIdentNode(":p" & $counter) var argStr = exp[i].toStrLit if exp[i].kind in nnkCallKinds: inspectArgs(exp[i]) argsAsgns.add getAst(asgn(arg, exp[i])) @@ -146,7 +146,8 @@ macro check*(conditions: stmt): stmt {.immediate.} = var checkedStr = checked.toStrLit inspectArgs(checked) - result = getAst(rewrite(checked, checked.lineinfo, checkedStr, argsAsgns, argsPrintOuts)) + result = getAst(rewrite(checked, checked.lineinfo, checkedStr, + argsAsgns, argsPrintOuts)) of nnkStmtList: result = newNimNode(nnkStmtList) @@ -176,7 +177,7 @@ macro expect*(exceptions: varargs[expr], body: stmt): stmt {.immediate.} = checkpoint(lineInfoLit & ": Expect Failed, no exception was thrown.") fail() except errorTypes: - nil + discard var body = exp[exp.len - 1] |