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)
| 2343 | // likely differs. All of the test cases here should eventually be moved |
| 2344 | // elsewhere. |
| 2345 | func 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 | |
| 2364 | func TestParseError(t *testing.T) { |
| 2365 | testData := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…