(t *testing.T)
| 476 | } |
| 477 | |
| 478 | func TestExtractErrorCode(t *testing.T) { |
| 479 | structErr := NewError(ErrCodeUnexpectedToken, "test", models.Location{}) |
| 480 | simpleErr := fmt.Errorf("simple error") |
| 481 | |
| 482 | // Test with structured error |
| 483 | code, ok := ExtractErrorCode(structErr) |
| 484 | if !ok { |
| 485 | t.Error("ExtractErrorCode() should return true for structured error") |
| 486 | } |
| 487 | if code != ErrCodeUnexpectedToken { |
| 488 | t.Errorf("ExtractErrorCode() code = %v, want %v", code, ErrCodeUnexpectedToken) |
| 489 | } |
| 490 | |
| 491 | // Test with simple error |
| 492 | _, ok = ExtractErrorCode(simpleErr) |
| 493 | if ok { |
| 494 | t.Error("ExtractErrorCode() should return false for simple error") |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | func TestFormatErrorWithUnicode(t *testing.T) { |
| 499 | tests := []struct { |
nothing calls this directly
no test coverage detected