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

Function parseSQLStrictWithPositions

pkg/sql/parser/parser_strictness_test.go:261–272  ·  view source on GitHub ↗

============================================================================= Issue #306 - ParseWithPositions strict mode trailing semicolon =============================================================================

(t *testing.T, sql string)

Source from the content-addressed store, hash-verified

259// =============================================================================
260
261func parseSQLStrictWithPositions(t *testing.T, sql string) error {
262 t.Helper()
263 tkz := tokenizer.GetTokenizer()
264 defer tokenizer.PutTokenizer(tkz)
265 tokens, err := tkz.Tokenize([]byte(sql))
266 if err != nil {
267 t.Fatalf("tokenize error for %q: %v", sql, err)
268 }
269 p := NewParser(WithStrictMode())
270 _, err = p.ParseFromModelTokensWithPositions(tokens)
271 return err
272}
273
274func TestStrictMode_ParseWithPositions_TrailingSemicolon(t *testing.T) {
275 if err := parseSQLStrictWithPositions(t, "SELECT 1;"); err != nil {

Calls 8

GetTokenizerFunction · 0.92
PutTokenizerFunction · 0.92
WithStrictModeFunction · 0.85
TokenizeMethod · 0.80
NewParserFunction · 0.70
HelperMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected