(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestFormatError(t *testing.T) { |
| 15 | tests := []struct { |
| 16 | name string |
| 17 | err CompilerError |
| 18 | expected []string // Substrings that should be present in output |
| 19 | }{ |
| 20 | { |
| 21 | name: "basic error with position", |
| 22 | err: CompilerError{ |
| 23 | Position: ErrorPosition{ |
| 24 | File: "test.md", |
| 25 | Line: 5, |
| 26 | Column: 10, |
| 27 | }, |
| 28 | Type: "error", |
| 29 | Message: "invalid syntax", |
| 30 | }, |
| 31 | expected: []string{ |
| 32 | "test.md:5:10:", |
| 33 | "error:", |
| 34 | "invalid syntax", |
| 35 | }, |
| 36 | }, |
| 37 | { |
| 38 | name: "warning with hint", |
| 39 | err: CompilerError{ |
| 40 | Position: ErrorPosition{ |
| 41 | File: "workflow.md", |
| 42 | Line: 2, |
| 43 | Column: 1, |
| 44 | }, |
| 45 | Type: "warning", |
| 46 | Message: "deprecated field", |
| 47 | Hint: "use 'new_field' instead", |
| 48 | }, |
| 49 | expected: []string{ |
| 50 | "workflow.md:2:1:", |
| 51 | "warning:", |
| 52 | "deprecated field", |
| 53 | "hint: use 'new_field' instead", |
| 54 | }, |
| 55 | }, |
| 56 | { |
| 57 | name: "error with context", |
| 58 | err: CompilerError{ |
| 59 | Position: ErrorPosition{ |
| 60 | File: "test.md", |
| 61 | Line: 3, |
| 62 | Column: 5, |
| 63 | }, |
| 64 | Type: "error", |
| 65 | Message: "missing colon", |
| 66 | Context: []string{ |
| 67 | "tools:", |
| 68 | " github", |
| 69 | " allowed: [list_issues]", |
| 70 | }, |
| 71 | }, |
nothing calls this directly
no test coverage detected