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

Function captureAddOutput

apps/cli/internal/cli/add_test.go:36–51  ·  view source on GitHub ↗
(t *testing.T, title string)

Source from the content-addressed store, hash-verified

34}
35
36func captureAddOutput(t *testing.T, title string) (string, error) {
37 t.Helper()
38
39 oldStdout := os.Stdout
40 r, w, _ := os.Pipe()
41 os.Stdout = w
42
43 err := runAdd(addCmd, []string{title})
44
45 w.Close()
46 os.Stdout = oldStdout
47
48 var buf bytes.Buffer
49 buf.ReadFrom(r)
50 return buf.String(), err
51}
52
53func TestAdd_HappyPath(t *testing.T) {
54 tmpDir := t.TempDir()

Callers 15

TestAdd_HappyPathFunction · 0.85
TestAdd_AllFlagsFunction · 0.85
TestAdd_GroupFlagFunction · 0.85
TestAdd_JSONOutputFunction · 0.85
TestAdd_InvalidPriorityFunction · 0.85
TestAdd_InvalidEffortFunction · 0.85
TestAdd_InvalidStatusFunction · 0.85
TestAdd_EmptyDirectoryFunction · 0.85
TestAdd_SequentialIDsFunction · 0.85
TestAdd_DependsOnParsingFunction · 0.85
TestAdd_TagsParsingFunction · 0.85

Calls 1

runAddFunction · 0.85

Tested by

no test coverage detected