(t *testing.T, dir string)
| 122 | } |
| 123 | |
| 124 | func captureReportOutput(t *testing.T, dir string) string { |
| 125 | t.Helper() |
| 126 | |
| 127 | oldStdout := os.Stdout |
| 128 | r, w, _ := os.Pipe() |
| 129 | os.Stdout = w |
| 130 | |
| 131 | err := runReport(reportCmd, []string{dir}) |
| 132 | if err != nil { |
| 133 | w.Close() |
| 134 | os.Stdout = oldStdout |
| 135 | t.Fatalf("runReport failed: %v", err) |
| 136 | } |
| 137 | |
| 138 | w.Close() |
| 139 | os.Stdout = oldStdout |
| 140 | |
| 141 | var buf bytes.Buffer |
| 142 | buf.ReadFrom(r) |
| 143 | return buf.String() |
| 144 | } |
| 145 | |
| 146 | // --- Markdown tests --- |
| 147 |
no test coverage detected