(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestDiagnosticTextWriter(t *testing.T) { |
| 15 | tests := []struct { |
| 16 | Input *Diagnostic |
| 17 | Want string |
| 18 | }{ |
| 19 | { |
| 20 | &Diagnostic{ |
| 21 | Severity: DiagError, |
| 22 | Summary: "Splines not reticulated", |
| 23 | Detail: "All splines must be pre-reticulated.", |
| 24 | Subject: &Range{ |
| 25 | Start: Pos{ |
| 26 | Byte: 0, |
| 27 | Column: 1, |
| 28 | Line: 1, |
| 29 | }, |
| 30 | End: Pos{ |
| 31 | Byte: 3, |
| 32 | Column: 4, |
| 33 | Line: 1, |
| 34 | }, |
| 35 | }, |
| 36 | }, |
| 37 | `Error: Splines not reticulated |
| 38 | |
| 39 | on line 1, in hardcoded-context: |
| 40 | 1: foo = 1 |
| 41 | |
| 42 | All splines must be pre-reticulated. |
| 43 | |
| 44 | `, |
| 45 | }, |
| 46 | { |
| 47 | &Diagnostic{ |
| 48 | Severity: DiagError, |
| 49 | Summary: "Unsupported attribute", |
| 50 | Detail: `"baz" is not a supported top-level attribute. Did you mean "bam"?`, |
| 51 | Subject: &Range{ |
| 52 | Start: Pos{ |
| 53 | Byte: 16, |
| 54 | Column: 1, |
| 55 | Line: 3, |
| 56 | }, |
| 57 | End: Pos{ |
| 58 | Byte: 19, |
| 59 | Column: 4, |
| 60 | Line: 3, |
| 61 | }, |
| 62 | }, |
| 63 | }, |
| 64 | `Error: Unsupported attribute |
| 65 | |
| 66 | on line 3, in hardcoded-context: |
| 67 | 3: baz = 3 |
| 68 | |
| 69 | "baz" is not a supported top-level |
| 70 | attribute. Did you mean "bam"? |
| 71 |
nothing calls this directly
no test coverage detected