MCPcopy Create free account
hub / github.com/AfterShip/clickhouse-sql-parser / validFormatSQL

Function validFormatSQL

parser/parser_test.go:160–171  ·  view source on GitHub ↗

validFormatSQL Verify that the format sql can be re-parsed with consistent results

(t *testing.T, sql string)

Source from the content-addressed store, hash-verified

158
159// validFormatSQL Verify that the format sql can be re-parsed with consistent results
160func validFormatSQL(t *testing.T, sql string) {
161 parser := NewParser(sql)
162 stmts, err := parser.ParseStmts()
163 require.NoError(t, err)
164 var builder strings.Builder
165 for _, stmt := range stmts {
166 builder.WriteString(Format(stmt))
167 builder.WriteByte(';')
168 builder.WriteByte('\n')
169 }
170 require.Equal(t, sql, builder.String())
171}
172
173func TestParser_InvalidSyntax(t *testing.T) {
174 invalidSQLs := []string{

Callers 2

TestParser_FormatFunction · 0.85
TestVisitor_IdenticalFunction · 0.85

Calls 6

ParseStmtsMethod · 0.95
NewParserFunction · 0.85
FormatFunction · 0.85
WriteStringMethod · 0.80
WriteByteMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…