(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestPrintIssue_WithoutTaskID(t *testing.T) { |
| 284 | issue := validator.ValidationIssue{ |
| 285 | Level: validator.LevelError, |
| 286 | Message: "global error", |
| 287 | } |
| 288 | |
| 289 | oldStdout := os.Stdout |
| 290 | r, w, _ := os.Pipe() |
| 291 | os.Stdout = w |
| 292 | |
| 293 | printIssue(issue, getRenderer()) |
| 294 | |
| 295 | w.Close() |
| 296 | os.Stdout = oldStdout |
| 297 | |
| 298 | var buf bytes.Buffer |
| 299 | buf.ReadFrom(r) |
| 300 | output := buf.String() |
| 301 | |
| 302 | if !strings.Contains(output, "global error") { |
| 303 | t.Errorf("expected message in output, got:\n%s", output) |
| 304 | } |
| 305 | // Should not contain bracket prefix for task ID |
| 306 | if strings.Contains(output, "[") && strings.Contains(output, "]") { |
| 307 | t.Errorf("expected no [ID] prefix, got:\n%s", output) |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | func TestPrintIssue_WithFilePath(t *testing.T) { |
| 312 | issue := validator.ValidationIssue{ |
nothing calls this directly
no test coverage detected