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

Function TestInvalidSyntaxError

pkg/errors/builders_test.go:143–160  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

141}
142
143func TestInvalidSyntaxError(t *testing.T) {
144 sql := "SELECT * FROM WHERE"
145 location := models.Location{Line: 1, Column: 15}
146
147 err := InvalidSyntaxError("missing table name", location, sql)
148
149 if err.Code != ErrCodeInvalidSyntax {
150 t.Errorf("InvalidSyntaxError() code = %v, want %v", err.Code, ErrCodeInvalidSyntax)
151 }
152
153 output := err.Error()
154 if !strings.Contains(output, "invalid syntax") {
155 t.Errorf("Error should mention invalid syntax, got: %s", output)
156 }
157 if !strings.Contains(output, "missing table name") {
158 t.Errorf("Error should include description, got: %s", output)
159 }
160}
161
162func TestUnsupportedFeatureError(t *testing.T) {
163 sql := "SELECT * FROM users WINDOW w AS (PARTITION BY dept)"

Callers

nothing calls this directly

Calls 3

InvalidSyntaxErrorFunction · 0.85
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected