MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestBug1_ErrorPositionColumnNonZero

Function TestBug1_ErrorPositionColumnNonZero

pkg/sql/parser/uat_bugs_test.go:94–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestBug1_ErrorPositionColumnNonZero(t *testing.T) {
95 // "SELECT id, FROM users" - the stray comma/FROM creates a parser error.
96 // Column should be non-zero.
97 err := parseExpectError(t, "SELECT id, FROM users")
98
99 sErr, ok := err.(*goerrors.Error)
100 if !ok {
101 t.Logf("not a *goerrors.Error (%T); checking string representation", err)
102 return
103 }
104
105 if sErr.Location.Line == 0 || sErr.Location.Column == 0 {
106 t.Errorf("expected non-zero line+column; got line=%d col=%d",
107 sErr.Location.Line, sErr.Location.Column)
108 }
109}
110
111func TestBug1_SuccessfulParseDoesNotIntroducePositionRegression(t *testing.T) {
112 // Sanity check: successful parse should still work after the fix.

Callers

nothing calls this directly

Calls 2

parseExpectErrorFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected