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

Function captureNextOutput

apps/cli/internal/cli/next_test.go:151–166  ·  view source on GitHub ↗

captureNextOutput runs runNext and captures stdout

(t *testing.T, args []string)

Source from the content-addressed store, hash-verified

149
150// captureNextOutput runs runNext and captures stdout
151func captureNextOutput(t *testing.T, args []string) (string, error) {
152 t.Helper()
153
154 oldStdout := os.Stdout
155 r, w, _ := os.Pipe()
156 os.Stdout = w
157
158 err := runNext(nextCmd, args)
159
160 w.Close()
161 os.Stdout = oldStdout
162
163 var buf bytes.Buffer
164 buf.ReadFrom(r)
165 return buf.String(), err
166}
167
168// resetNextFlags resets all next command flags to defaults
169func resetNextFlags() {

Callers 15

TestNext_BasicRankingFunction · 0.85
TestNext_LimitFlagFunction · 0.85
TestNext_FilterByTagFunction · 0.85
TestNext_MultipleFiltersFunction · 0.85
TestNext_JSONFormatFunction · 0.85
TestNext_YAMLFormatFunction · 0.85

Calls 1

runNextFunction · 0.85

Tested by

no test coverage detected