mirror of
https://github.com/status-im/nim-unittest2.git
synced 2025-02-23 23:28:07 +00:00
workaround for nim 1.2 backward compatibility: exception in terminal.nim
This commit is contained in:
parent
bed1d50a45
commit
828310e512
@ -132,7 +132,7 @@
|
|||||||
import std/[locks, macros, sets, strutils, streams, times, monotimes]
|
import std/[locks, macros, sets, strutils, streams, times, monotimes]
|
||||||
|
|
||||||
{.warning[LockLevel]:off.}
|
{.warning[LockLevel]:off.}
|
||||||
|
|
||||||
when declared(stdout):
|
when declared(stdout):
|
||||||
import std/os
|
import std/os
|
||||||
|
|
||||||
@ -366,9 +366,14 @@ method suiteStarted*(formatter: ConsoleOutputFormatter, suiteName: string) =
|
|||||||
template rawPrint() = echo("\n[Suite] ", suiteName)
|
template rawPrint() = echo("\n[Suite] ", suiteName)
|
||||||
when useTerminal:
|
when useTerminal:
|
||||||
if formatter.colorOutput:
|
if formatter.colorOutput:
|
||||||
try:
|
when (NimMajor, NimMinor) < (1, 4) and defined(windows):
|
||||||
styledEcho styleBright, fgBlue, "\n[Suite] ", resetStyle, suiteName
|
try:
|
||||||
except CatchableError: rawPrint() # Work around exceptions in `terminal.nim`
|
styledEcho styleBright, fgBlue, "\n[Suite] ", resetStyle, suiteName
|
||||||
|
except Exception: rawPrint() # Work around exceptions in `terminal.nim`
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
styledEcho styleBright, fgBlue, "\n[Suite] ", resetStyle, suiteName
|
||||||
|
except CatchableError: rawPrint() # Work around exceptions in `terminal.nim`
|
||||||
else: rawPrint()
|
else: rawPrint()
|
||||||
else: rawPrint()
|
else: rawPrint()
|
||||||
formatter.isInSuite = true
|
formatter.isInSuite = true
|
||||||
@ -411,10 +416,16 @@ method testEnded*(formatter: ConsoleOutputFormatter, testResult: TestResult) =
|
|||||||
of TestStatus.OK: fgGreen
|
of TestStatus.OK: fgGreen
|
||||||
of TestStatus.FAILED: fgRed
|
of TestStatus.FAILED: fgRed
|
||||||
of TestStatus.SKIPPED: fgYellow
|
of TestStatus.SKIPPED: fgYellow
|
||||||
try:
|
when (NimMajor, NimMinor) < (1, 4) and defined(windows):
|
||||||
styledEcho styleBright, color, testHeader,
|
try:
|
||||||
resetStyle, testResult.testName
|
styledEcho styleBright, color, testHeader,
|
||||||
except CatchableError: rawPrint() # Work around exceptions in `terminal.nim`
|
resetStyle, testResult.testName
|
||||||
|
except Exception: rawPrint() # Work around exceptions in `terminal.nim`
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
styledEcho styleBright, color, testHeader,
|
||||||
|
resetStyle, testResult.testName
|
||||||
|
except CatchableError: rawPrint() # Work around exceptions in `terminal.nim`
|
||||||
else:
|
else:
|
||||||
rawPrint()
|
rawPrint()
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user