Skip to content

Commit

Permalink
unittest add resetOutputFormatters proc (#13267)
Browse files Browse the repository at this point in the history
* add resetOutputFormatters

* remove space

* resolve comments
  • Loading branch information
cooldome authored Jan 28, 2020
1 parent 46bfb59 commit 84e8477
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
This simplifies code by reducing need for if-else branches around intermediate maybe nil values.
Eg: `echo ?.n.typ.kind`
- Added `minIndex` and `maxIndex` to the `sequtils` module

- Added `os.isRelativeTo` to tell whether a path is relative to another
- Added `resetOutputFormatters` to `unittest`

## Library changes

Expand Down
5 changes: 5 additions & 0 deletions lib/pure/unittest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
import
macros, strutils, streams, times, sets, sequtils

include "system/inclrtl"

when declared(stdout):
import os

Expand Down Expand Up @@ -186,6 +188,9 @@ proc delOutputFormatter*(formatter: OutputFormatter) =
keepIf(formatters, proc (x: OutputFormatter): bool =
x != formatter)

proc resetOutputFormatters* {.since: (1, 1).} =
formatters = @[]

proc newConsoleOutputFormatter*(outputLevel: OutputLevel = OutputLevel.PRINT_ALL,
colorOutput = true): <//>ConsoleOutputFormatter =
ConsoleOutputFormatter(
Expand Down

0 comments on commit 84e8477

Please sign in to comment.