saveGlobalState snapshots package-level state that selectEventProcessor mutates (display.Mode and, in JSON mode, the logrus standard formatter) and restores it on test cleanup.
(t *testing.T)
| 37 | // mutates (display.Mode and, in JSON mode, the logrus standard formatter) |
| 38 | // and restores it on test cleanup. |
| 39 | func saveGlobalState(t *testing.T) { |
| 40 | t.Helper() |
| 41 | originalMode := display.Mode |
| 42 | originalFormatter := logrus.StandardLogger().Formatter |
| 43 | t.Cleanup(func() { |
| 44 | display.Mode = originalMode |
| 45 | logrus.SetFormatter(originalFormatter) |
| 46 | }) |
| 47 | } |
| 48 | |
| 49 | // newStream returns a *streams.Out whose IsTerminal() matches tty. When tty is |
| 50 | // true it is backed by a pseudo-terminal slave; otherwise by an os.Pipe writer. |
no outgoing calls
no test coverage detected