(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func NewPiped(t *testing.T) (*Expecter, io.Writer) { |
| 89 | r, w := io.Pipe() |
| 90 | e := New(t, r, "cmd") |
| 91 | |
| 92 | t.Cleanup(func() { |
| 93 | // Close writer here at the end of the test to ensure we don't leak goroutines reading from the pipe. |
| 94 | _ = w.Close() |
| 95 | e.Close("test end") |
| 96 | }) |
| 97 | return e, w |
| 98 | } |
| 99 | |
| 100 | type Expecter struct { |
| 101 | t *testing.T |