Skip to content

Commit

Permalink
fix nim-lang#10261 unittest now returns 1 on error instead of buggy b…
Browse files Browse the repository at this point in the history
…ehavior
  • Loading branch information
timotheecour committed Jan 10, 2019
1 parent ab425d7 commit e452c4e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/pure/unittest.nim
Expand Up @@ -145,6 +145,8 @@ type
testStartTime: float
testStackTrace: string

const EXIT_ERROR = 1

var
abortOnError* {.threadvar.}: bool ## Set to true in order to quit
## immediately on fail. Default is false,
Expand Down Expand Up @@ -499,7 +501,7 @@ template test*(name, body) {.dirty.} =

finally:
if testStatusIMPL == FAILED:
programResult += 1
programResult = EXIT_ERROR
let testResult = TestResult(
suiteName: when declared(testSuiteName): testSuiteName else: "",
testName: name,
Expand Down Expand Up @@ -540,7 +542,7 @@ template fail* =
when declared(testStatusIMPL):
testStatusIMPL = FAILED
else:
programResult += 1
programResult = EXIT_ERROR

ensureInitialized()

Expand Down

0 comments on commit e452c4e

Please sign in to comment.