parent
db67e2ad76
commit
13bf4d444d
|
@ -20,7 +20,35 @@ discard """
|
|||
'''
|
||||
"""
|
||||
|
||||
import unittest2, sequtils
|
||||
import ../unittest2, sequtils
|
||||
from std/exitprocs import nil
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Tests using backdoors
|
||||
# This kind of tests should be executed first
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
suite "PR #35":
|
||||
setup:
|
||||
# ensure teardown is called at the end
|
||||
doAssert(true)
|
||||
|
||||
teardown:
|
||||
if testStatusIMPL != TestStatus.FAILED:
|
||||
testStatusIMPL = TestStatus.FAILED
|
||||
exitProcs.setProgramResult(QuitFailure)
|
||||
debugEcho "PR #35 test FAILED"
|
||||
else:
|
||||
testStatusIMPL = TestStatus.OK
|
||||
exitProcs.setProgramResult(QuitSuccess)
|
||||
|
||||
test "something":
|
||||
# emulate exception
|
||||
raise newException(ValueError, "error")
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Regular tests
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
proc doThings(spuds: var int): int =
|
||||
spuds = 24
|
||||
|
|
|
@ -1028,7 +1028,7 @@ template fail* =
|
|||
when declared(testStatusIMPL):
|
||||
testStatusIMPL = TestStatus.FAILED
|
||||
|
||||
programResult = 1
|
||||
exitProcs.setProgramResult(1)
|
||||
|
||||
for formatter in formatters:
|
||||
let formatter = formatter # avoid lent iterator
|
||||
|
|
Loading…
Reference in New Issue