(t *testing.T)
| 194 | } |
| 195 | |
| 196 | func TestProjects_UnreachablePath(t *testing.T) { |
| 197 | resetProjectsFlags() |
| 198 | |
| 199 | // Create one valid project |
| 200 | projectDir := createProjectWithTasks(t, "tasks", map[string]string{ |
| 201 | "001.md": taskFile("001", "Task A", "pending"), |
| 202 | }) |
| 203 | |
| 204 | setupGlobalRegistry(t, "projects:\n"+ |
| 205 | " - id: missing\n"+ |
| 206 | " name: \"Missing Project\"\n"+ |
| 207 | " path: /nonexistent/path/that/does/not/exist\n"+ |
| 208 | " - id: valid\n"+ |
| 209 | " name: \"Valid Project\"\n"+ |
| 210 | " path: "+projectDir+"\n") |
| 211 | |
| 212 | stdout, stderr, err := captureProjectsOutput(t) |
| 213 | if err != nil { |
| 214 | t.Fatalf("unexpected error: %v", err) |
| 215 | } |
| 216 | |
| 217 | if !strings.Contains(stderr, "Warning") { |
| 218 | t.Errorf("expected warning for missing project, got stderr:\n%s", stderr) |
| 219 | } |
| 220 | if !strings.Contains(stderr, "Missing Project") { |
| 221 | t.Errorf("expected warning to mention 'Missing Project', got stderr:\n%s", stderr) |
| 222 | } |
| 223 | |
| 224 | // Valid project should still appear |
| 225 | if !strings.Contains(stdout, "Valid Project") { |
| 226 | t.Errorf("expected valid project in output, got:\n%s", stdout) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | func TestProjects_YAMLOutput(t *testing.T) { |
| 231 | resetProjectsFlags() |
nothing calls this directly
no test coverage detected