| 105 | } |
| 106 | |
| 107 | func TestError_WithHint(t *testing.T) { |
| 108 | err := NewError(ErrCodeUnexpectedToken, "unexpected token", models.Location{Line: 1, Column: 5}) |
| 109 | err.WithHint("This is a helpful hint") |
| 110 | |
| 111 | if err.Hint != "This is a helpful hint" { |
| 112 | t.Errorf("WithHint() failed to set hint, got: %s", err.Hint) |
| 113 | } |
| 114 | |
| 115 | output := err.Error() |
| 116 | if !strings.Contains(output, "Hint: This is a helpful hint") { |
| 117 | t.Errorf("Error output should contain hint, got: %s", output) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func TestNewError(t *testing.T) { |
| 122 | location := models.Location{Line: 5, Column: 10} |