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

Function captureGetOutput

apps/cli/internal/cli/get_test.go:85–105  ·  view source on GitHub ↗
(t *testing.T, query string)

Source from the content-addressed store, hash-verified

83}
84
85func captureGetOutput(t *testing.T, query string) string {
86 t.Helper()
87
88 oldStdout := os.Stdout
89 r, w, _ := os.Pipe()
90 os.Stdout = w
91
92 err := runGet(getCmd, []string{query})
93 if err != nil {
94 w.Close()
95 os.Stdout = oldStdout
96 t.Fatalf("runGet failed: %v", err)
97 }
98
99 w.Close()
100 os.Stdout = oldStdout
101
102 var buf bytes.Buffer
103 buf.ReadFrom(r)
104 return buf.String()
105}
106
107func TestGet_ExactMatchByID(t *testing.T) {
108 tmpDir := createGetTestFiles(t)

Calls 1

runGetFunction · 0.85

Tested by

no test coverage detected