(t *testing.T)
| 333 | } |
| 334 | |
| 335 | func TestFormatErrorWithExample(t *testing.T) { |
| 336 | got := FormatErrorWithExample( |
| 337 | ErrCodeExpectedToken, |
| 338 | "expected FROM, got FORM", |
| 339 | models.Location{Line: 1, Column: 10}, |
| 340 | "SELECT * FORM users", |
| 341 | 4, |
| 342 | "SELECT * FORM users", |
| 343 | "SELECT * FROM users", |
| 344 | ) |
| 345 | |
| 346 | requiredParts := []string{ |
| 347 | "expected FROM, got FORM", |
| 348 | "Wrong:", |
| 349 | "SELECT * FORM users", |
| 350 | "Correct:", |
| 351 | "SELECT * FROM users", |
| 352 | "Hint:", |
| 353 | } |
| 354 | |
| 355 | for _, part := range requiredParts { |
| 356 | if !strings.Contains(got, part) { |
| 357 | t.Errorf("FormatErrorWithExample() missing %q\nGot:\n%s", part, got) |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | func TestFormatContextWindow(t *testing.T) { |
| 363 | sql := `SELECT id, name, email |
nothing calls this directly
no test coverage detected