(t *testing.T, fn func() error)
| 29 | ` |
| 30 | |
| 31 | func captureFeedOutput(t *testing.T, fn func() error) (string, error) { |
| 32 | t.Helper() |
| 33 | oldStdout := os.Stdout |
| 34 | r, w, _ := os.Pipe() |
| 35 | os.Stdout = w |
| 36 | |
| 37 | err := fn() |
| 38 | |
| 39 | w.Close() |
| 40 | os.Stdout = oldStdout |
| 41 | |
| 42 | var buf bytes.Buffer |
| 43 | buf.ReadFrom(r) |
| 44 | return buf.String(), err |
| 45 | } |
| 46 | |
| 47 | func resetFeedFlags() { |
| 48 | feedFormat = "text" |
no outgoing calls
no test coverage detected