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

Function TestStaticExprCtxApplyOptions

pkg/expression/exprstatic/exprctx_test.go:43–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestStaticExprCtxApplyOptions(t *testing.T) {
44 ctx := NewExprContext()
45 oldEvalCtx := ctx.evalCtx
46 oldColumnIDAllocator := ctx.columnIDAllocator
47
48 // apply with options
49 opts, s := getExprCtxOptionsForTest()
50 ctx2 := ctx.Apply(opts...)
51 require.Equal(t, oldEvalCtx, ctx.evalCtx)
52 require.Same(t, oldColumnIDAllocator, ctx.columnIDAllocator)
53 checkDefaultStaticExprCtx(t, ctx)
54 checkOptionsStaticExprCtx(t, ctx2, s)
55
56 // apply with empty options
57 ctx3 := ctx2.Apply()
58 s.skipCacheArgs = nil
59 checkOptionsStaticExprCtx(t, ctx3, s)
60}
61
62func checkDefaultStaticExprCtx(t *testing.T, ctx *ExprContext) {
63 checkDefaultStaticEvalCtx(t, ctx.GetEvalCtx().(*EvalContext))

Callers

nothing calls this directly

Calls 7

ApplyMethod · 0.95
getExprCtxOptionsForTestFunction · 0.85
NewExprContextFunction · 0.70
EqualMethod · 0.65
ApplyMethod · 0.65

Tested by

no test coverage detected