MCPcopy
hub / github.com/pingcap/tidb / RunTestInRealAsFloatMode

Function RunTestInRealAsFloatMode

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

Source from the content-addressed store, hash-verified

404}
405
406func RunTestInRealAsFloatMode(t *testing.T, table []testCase, enableWindowFunc bool) {
407 p := parser.New()
408 p.EnableWindowFunc(enableWindowFunc)
409 p.SetSQLMode(mysql.ModeRealAsFloat)
410 for _, tbl := range table {
411 _, _, err := p.Parse(tbl.src, "", "")
412 comment := fmt.Sprintf("source %v", tbl.src)
413 if !tbl.ok {
414 require.Error(t, err, comment)
415 continue
416 }
417 require.NoError(t, err, comment)
418 // restore correctness test
419 if tbl.ok {
420 RunRestoreTestInRealAsFloatMode(t, tbl.src, tbl.restore, enableWindowFunc)
421 }
422 }
423}
424
425func RunRestoreTestInRealAsFloatMode(t *testing.T, sourceSQLs, expectSQLs string, enableWindowFunc bool) {
426 var sb strings.Builder

Callers 1

TestBuiltinFunction · 0.85

Calls 6

NewFunction · 0.92
ParseMethod · 0.65
ErrorMethod · 0.65
EnableWindowFuncMethod · 0.45
SetSQLModeMethod · 0.45

Tested by

no test coverage detected