made some tests green

This commit is contained in:
Araq
2012-09-12 08:43:24 +02:00
parent d48d3d0bd1
commit 8178cd4fab
21 changed files with 42 additions and 39 deletions

View File

@@ -31,19 +31,19 @@ var
checkpoints: seq[string] = @[]
template TestSetupIMPL*: stmt {.dirty.} = nil
template TestTeardownIMPL*: stmt {.dirty.} = nil
template TestSetupIMPL*: stmt {.immediate, dirty.} = nil
template TestTeardownIMPL*: stmt {.immediate, dirty.} = nil
proc shouldRun(testName: string): bool =
result = true
template suite*(name: expr, body: stmt): stmt {.dirty.} =
template suite*(name: expr, body: stmt): stmt {.immediate, dirty.} =
block:
template setup*(setupBody: stmt): stmt {.dirty.} =
template TestSetupIMPL: stmt {.dirty.} = setupBody
template setup*(setupBody: stmt): stmt {.immediate, dirty.} =
template TestSetupIMPL: stmt {.immediate, dirty.} = setupBody
template teardown*(teardownBody: stmt): stmt {.dirty.} =
template TestTeardownIMPL: stmt {.dirty.} = teardownBody
template teardown*(teardownBody: stmt): stmt {.immediate, dirty.} =
template TestTeardownIMPL: stmt {.immediate, dirty.} = teardownBody
body
@@ -59,7 +59,7 @@ proc testDone(name: string, s: TTestStatus) =
else:
echo "[", $s, "] ", name, "\n"
template test*(name: expr, body: stmt): stmt {.dirty.} =
template test*(name: expr, body: stmt): stmt {.immediate, dirty.} =
bind shouldRun, checkpoints, testDone
if shouldRun(name):
@@ -148,7 +148,7 @@ macro check*(conditions: stmt): stmt {.immediate.} =
var ast = conditions.treeRepr
error conditions.lineinfo & ": Malformed check statement:\n" & ast
template require*(conditions: stmt): stmt {.dirty.} =
template require*(conditions: stmt): stmt {.immediate, dirty.} =
block:
const AbortOnError {.inject.} = true
check conditions

View File

@@ -245,9 +245,7 @@ when not defined(useNimRtl):
# We jump through some hops here to ensure that Nimrod thread procs can have
# the Nimrod calling convention. This is needed because thread procs are
# ``stdcall`` on Windows and ``noconv`` on UNIX. Alternative would be to just
# use ``stdcall`` since it is mapped to ``noconv`` on UNIX anyway. However,
# the current approach will likely result in less problems later when we have
# GC'ed closures in Nimrod.
# use ``stdcall`` since it is mapped to ``noconv`` on UNIX anyway.
type
TThread* {.pure, final.}[TArg] =
@@ -265,7 +263,7 @@ type
when not defined(boehmgc) and not hasSharedHeap:
proc deallocOsPages()
template ThreadProcWrapperBody(closure: expr) =
template ThreadProcWrapperBody(closure: expr) {.immediate.} =
when defined(globalsSlot): ThreadVarSetValue(globalsSlot, closure)
var t = cast[ptr TThread[TArg]](closure)
when useStackMaskHack: