Skip to content

Commit 84e8477

Browse files
authored
unittest add resetOutputFormatters proc (#13267)
* add resetOutputFormatters * remove space * resolve comments
1 parent 46bfb59 commit 84e8477

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
This simplifies code by reducing need for if-else branches around intermediate maybe nil values.
5353
Eg: `echo ?.n.typ.kind`
5454
- Added `minIndex` and `maxIndex` to the `sequtils` module
55-
5655
- Added `os.isRelativeTo` to tell whether a path is relative to another
56+
- Added `resetOutputFormatters` to `unittest`
5757

5858
## Library changes
5959

lib/pure/unittest.nim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
import
9797
macros, strutils, streams, times, sets, sequtils
9898

99+
include "system/inclrtl"
100+
99101
when declared(stdout):
100102
import os
101103

@@ -186,6 +188,9 @@ proc delOutputFormatter*(formatter: OutputFormatter) =
186188
keepIf(formatters, proc (x: OutputFormatter): bool =
187189
x != formatter)
188190

191+
proc resetOutputFormatters* {.since: (1, 1).} =
192+
formatters = @[]
193+
189194
proc newConsoleOutputFormatter*(outputLevel: OutputLevel = OutputLevel.PRINT_ALL,
190195
colorOutput = true): <//>ConsoleOutputFormatter =
191196
ConsoleOutputFormatter(

0 commit comments

Comments
 (0)