(t *testing.T, ctx sessionctx.Context, is infoschema.InfoSchema, sql string, inPrepare bool, terr error)
| 39 | ) |
| 40 | |
| 41 | func runSQL(t *testing.T, ctx sessionctx.Context, is infoschema.InfoSchema, sql string, inPrepare bool, terr error) { |
| 42 | stmts, err := session.Parse(ctx, sql) |
| 43 | require.NoErrorf(t, err, "sql: %s", sql) |
| 44 | require.Len(t, stmts, 1) |
| 45 | stmt := stmts[0] |
| 46 | var opts []core.PreprocessOpt |
| 47 | if inPrepare { |
| 48 | opts = append(opts, core.InPrepare) |
| 49 | } |
| 50 | nodeW := resolve.NewNodeW(stmt) |
| 51 | err = core.Preprocess(context.Background(), ctx, nodeW, append(opts, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))...) |
| 52 | require.Truef(t, terror.ErrorEqual(err, terr), "sql: %s, err:%v", sql, err) |
| 53 | } |
| 54 | |
| 55 | func TestValidator(t *testing.T) { |
| 56 | tests := []struct { |
no test coverage detected