diff options
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/asyncdispatch.nim | 2 | ||||
-rw-r--r-- | lib/pure/collections/sharedtables.nim | 2 | ||||
-rw-r--r-- | lib/pure/unittest.nim | 17 |
3 files changed, 9 insertions, 12 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 87c6aa7e2..1421db2e8 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -166,8 +166,6 @@ ## ## * The effect system (``raises: []``) does not work with async procedures. -include "system/inclrtl" - import os, tables, strutils, times, heapqueue, options, asyncstreams import options, math, std/monotimes import asyncfutures except callSoon diff --git a/lib/pure/collections/sharedtables.nim b/lib/pure/collections/sharedtables.nim index 2a1c0543f..cad9ca2c1 100644 --- a/lib/pure/collections/sharedtables.nim +++ b/lib/pure/collections/sharedtables.nim @@ -17,8 +17,6 @@ import hashes, math, locks -include "system/inclrtl" - type KeyValuePair[A, B] = tuple[hcode: Hash, key: A, val: B] KeyValuePairSeq[A, B] = ptr UncheckedArray[KeyValuePair[A, B]] diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 6e0147595..6c434bb19 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -101,7 +101,9 @@ include "system/inclrtl" when declared(stdout): import os -when not defined(ECMAScript): +const useTerminal = not defined(js) + +when useTerminal: import terminal type @@ -224,7 +226,7 @@ proc defaultConsoleFormatter*(): <//>ConsoleOutputFormatter = method suiteStarted*(formatter: ConsoleOutputFormatter, suiteName: string) = template rawPrint() = echo("\n[Suite] ", suiteName) - when not defined(ECMAScript): + when useTerminal: if formatter.colorOutput: styledEcho styleBright, fgBlue, "\n[Suite] ", resetStyle, suiteName else: rawPrint() @@ -250,7 +252,7 @@ method testEnded*(formatter: ConsoleOutputFormatter, testResult: TestResult) = let prefix = if testResult.suiteName.len > 0: " " else: "" template rawPrint() = echo(prefix, "[", $testResult.status, "] ", testResult.testName) - when not defined(ECMAScript): + when useTerminal: if formatter.colorOutput: var color = case testResult.status of TestStatus.OK: fgGreen @@ -515,11 +517,10 @@ template test*(name, body) {.dirty.} = body except: - when not defined(js): - let e = getCurrentException() - let eTypeDesc = "[" & exceptionTypeName(e) & "]" - checkpoint("Unhandled exception: " & getCurrentExceptionMsg() & " " & eTypeDesc) - var stackTrace {.inject.} = e.getStackTrace() + let e = getCurrentException() + let eTypeDesc = "[" & exceptionTypeName(e) & "]" + checkpoint("Unhandled exception: " & getCurrentExceptionMsg() & " " & eTypeDesc) + var stackTrace {.inject.} = e.getStackTrace() fail() finally: |