MCPcopy
hub / github.com/XiaoMi/Gaea / RunTest

Function RunTest

parser/parser_test.go:253–268  ·  view source on GitHub ↗
(t *testing.T, table []testCase, enableWindowFunc bool)

Source from the content-addressed store, hash-verified

251}
252
253func RunTest(t *testing.T, table []testCase, enableWindowFunc bool) {
254 parser := parser.New()
255 parser.EnableWindowFunc(enableWindowFunc)
256 for _, tbl := range table {
257 _, _, err := parser.Parse(tbl.src, "", "")
258 if !tbl.ok {
259 require.Errorf(t, err, "source %v", tbl.src, errors.Trace(err))
260 continue
261 }
262 require.NoErrorf(t, err, "source %v", tbl.src, errors.Trace(err))
263 // restore correctness test
264 if tbl.ok {
265 RunRestoreTest(t, tbl.src, tbl.restore, enableWindowFunc)
266 }
267 }
268}
269
270func RunRestoreTest(t *testing.T, sourceSQLs, expectSQLs string, enableWindowFunc bool) {
271 var sb strings.Builder

Callers 15

TestDMLStmtFunction · 0.85
TestDBAStmtFunction · 0.85
TestExpressionFunction · 0.85
TestBuiltinFunction · 0.85
TestIdentifierFunction · 0.85
TestDDLFunction · 0.85
TestTypeFunction · 0.85
TestPrivilegeFunction · 0.85
TestCommentFunction · 0.85
TestSubqueryFunction · 0.85
TestUnionFunction · 0.85
TestLikeEscapeFunction · 0.85

Calls 6

NewFunction · 0.92
RunRestoreTestFunction · 0.85
ErrorfMethod · 0.65
TraceMethod · 0.65
EnableWindowFuncMethod · 0.45
ParseMethod · 0.45

Tested by

no test coverage detected