(t *testing.T)
| 185 | } |
| 186 | |
| 187 | func TestOutputStatsTable_EmptyBreakdowns(t *testing.T) { |
| 188 | m := &metrics.Metrics{ |
| 189 | TotalTasks: 0, |
| 190 | TasksByStatus: map[model.Status]int{}, |
| 191 | TasksByPriority: map[model.Priority]int{}, |
| 192 | TasksByEffort: map[model.Effort]int{}, |
| 193 | TasksByType: map[model.TaskType]int{}, |
| 194 | } |
| 195 | |
| 196 | // Capture output |
| 197 | oldStdout := os.Stdout |
| 198 | r, w, _ := os.Pipe() |
| 199 | os.Stdout = w |
| 200 | |
| 201 | err := outputStatsTable(m, "") |
| 202 | |
| 203 | w.Close() |
| 204 | os.Stdout = oldStdout |
| 205 | |
| 206 | var buf bytes.Buffer |
| 207 | buf.ReadFrom(r) |
| 208 | output := buf.String() |
| 209 | |
| 210 | if err != nil { |
| 211 | t.Fatalf("outputStatsTable failed: %v", err) |
| 212 | } |
| 213 | |
| 214 | // Each empty breakdown should print "(none)" |
| 215 | count := strings.Count(output, "(none)") |
| 216 | if count < 3 { |
| 217 | t.Errorf("expected at least 3 '(none)' strings (status, priority, effort), got %d\noutput:\n%s", count, output) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | func createStatsPhaseTestFiles(t *testing.T) string { |
| 222 | t.Helper() |
nothing calls this directly
no test coverage detected