MCPcopy Create free account
hub / github.com/driangle/taskmd / captureFeedOutput

Function captureFeedOutput

apps/cli/internal/cli/feed_test.go:31–45  ·  view source on GitHub ↗
(t *testing.T, fn func() error)

Source from the content-addressed store, hash-verified

29`
30
31func 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
47func resetFeedFlags() {
48 feedFormat = "text"

Calls

no outgoing calls

Tested by

no test coverage detected