(t *testing.T, title string)
| 34 | } |
| 35 | |
| 36 | func 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 | |
| 53 | func TestAdd_HappyPath(t *testing.T) { |
| 54 | tmpDir := t.TempDir() |
no test coverage detected