MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / TestParseSyntax

Function TestParseSyntax

pkg/sql/parser/parse_test.go:2345–2362  ·  view source on GitHub ↗

TestParseSyntax verifies that parsing succeeds, though the syntax tree likely differs. All of the test cases here should eventually be moved elsewhere.

(t *testing.T)

Source from the content-addressed store, hash-verified

2343// likely differs. All of the test cases here should eventually be moved
2344// elsewhere.
2345func TestParseSyntax(t *testing.T) {
2346 testData := []struct {
2347 sql string
2348 }{
2349 {`SELECT '\0' FROM a`},
2350 {`SELECT ((1)) FROM t WHERE ((a)) IN (((1))) AND ((a, b)) IN ((((1, 1))), ((2, 2)))`},
2351 {`SELECT e'\'\"\b\n\r\t\\' FROM t`},
2352 {`SELECT '\x' FROM t`},
2353 }
2354 for _, d := range testData {
2355 t.Run(d.sql, func(t *testing.T) {
2356 if _, err := parser.Parse(d.sql); err != nil {
2357 t.Fatalf("%s: expected success, but not parsable %s", d.sql, err)
2358 }
2359 sqlutils.VerifyStatementPrettyRoundtrip(t, d.sql)
2360 })
2361 }
2362}
2363
2364func TestParseError(t *testing.T) {
2365 testData := []struct {

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…