diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 135a24e9a866..568943ecb89c 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -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, @@ -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, @@ -540,7 +542,7 @@ template fail* = when declared(testStatusIMPL): testStatusIMPL = FAILED else: - programResult += 1 + programResult = EXIT_ERROR ensureInitialized()