(t *testing.T)
| 295 | } |
| 296 | |
| 297 | func TestProjects_InvalidFormat(t *testing.T) { |
| 298 | resetProjectsFlags() |
| 299 | projectsFormat = "csv" |
| 300 | |
| 301 | setupGlobalRegistry(t, "projects:\n"+ |
| 302 | " - id: proj1\n"+ |
| 303 | " name: \"Test\"\n"+ |
| 304 | " path: /tmp\n") |
| 305 | |
| 306 | // Create the /tmp path so it passes stat check, but the format error should come first |
| 307 | // since collectProjectSummaries runs before format switch — actually format switch is after. |
| 308 | // We need a valid project for the format branch to be reached. |
| 309 | projectDir := createProjectWithTasks(t, "tasks", map[string]string{ |
| 310 | "001.md": taskFile("001", "Task", "pending"), |
| 311 | }) |
| 312 | setupGlobalRegistry(t, "projects:\n"+ |
| 313 | " - id: proj1\n"+ |
| 314 | " name: \"Test\"\n"+ |
| 315 | " path: "+projectDir+"\n") |
| 316 | |
| 317 | _, _, err := captureProjectsOutput(t) |
| 318 | if err == nil { |
| 319 | t.Fatal("expected error for invalid format") |
| 320 | } |
| 321 | if !strings.Contains(err.Error(), "unsupported format") { |
| 322 | t.Errorf("expected 'unsupported format' error, got: %v", err) |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | // taskFile is a helper to generate task markdown content. |
| 327 | func taskFile(id, title, status string) string { |
nothing calls this directly
no test coverage detected