captureSnapshotOutput runs the snapshot command and captures stdout.
(t *testing.T, args []string)
| 92 | |
| 93 | // captureSnapshotOutput runs the snapshot command and captures stdout. |
| 94 | func captureSnapshotOutput(t *testing.T, args []string) (string, error) { |
| 95 | t.Helper() |
| 96 | |
| 97 | oldStdout := os.Stdout |
| 98 | r, w, _ := os.Pipe() |
| 99 | os.Stdout = w |
| 100 | |
| 101 | err := runSnapshot(snapshotCmd, args) |
| 102 | |
| 103 | w.Close() |
| 104 | os.Stdout = oldStdout |
| 105 | |
| 106 | var buf bytes.Buffer |
| 107 | buf.ReadFrom(r) |
| 108 | return buf.String(), err |
| 109 | } |
| 110 | |
| 111 | // --- Analysis function tests (pure, no I/O) --- |
| 112 |
no test coverage detected