(t *testing.T)
| 455 | } |
| 456 | |
| 457 | func TestExtractLocation(t *testing.T) { |
| 458 | location := models.Location{Line: 5, Column: 10} |
| 459 | structErr := NewError(ErrCodeUnexpectedToken, "test", location) |
| 460 | simpleErr := fmt.Errorf("simple error") |
| 461 | |
| 462 | // Test with structured error |
| 463 | gotLoc, ok := ExtractLocation(structErr) |
| 464 | if !ok { |
| 465 | t.Error("ExtractLocation() should return true for structured error") |
| 466 | } |
| 467 | if gotLoc != location { |
| 468 | t.Errorf("ExtractLocation() location = %v, want %v", gotLoc, location) |
| 469 | } |
| 470 | |
| 471 | // Test with simple error |
| 472 | _, ok = ExtractLocation(simpleErr) |
| 473 | if ok { |
| 474 | t.Error("ExtractLocation() should return false for simple error") |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | func TestExtractErrorCode(t *testing.T) { |
| 479 | structErr := NewError(ErrCodeUnexpectedToken, "test", models.Location{}) |
nothing calls this directly
no test coverage detected