MCPcopy Index your code
hub / github.com/pingcap/tidb / TestOptionalPropKey

Function TestOptionalPropKey

pkg/expression/exprctx/optional_test.go:86–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestOptionalPropKey(t *testing.T) {
87 for i := 0; i < OptPropsCnt; i++ {
88 key := OptionalEvalPropKey(i)
89 keySet := key.AsPropKeySet()
90 // keySet should contain the specified key
91 require.True(t, keySet.Contains(key))
92 // desc in optionalPropertyDescList should be the same with key.Desc()
93 require.Equal(t, key, optionalPropertyDescList[i].Key())
94 require.Same(t, &optionalPropertyDescList[i], key.Desc())
95 // keySet should not contain other keys
96 for j := 0; j < OptPropsCnt; j++ {
97 if i != j {
98 key2 := OptionalEvalPropKey(j)
99 require.False(t, keySet.Contains(key2))
100 }
101 }
102 // If key removed from the keySet, the keySet should be empty
103 keySet = keySet.Remove(key)
104 require.True(t, keySet.IsEmpty())
105 }
106}

Callers

nothing calls this directly

Calls 8

OptionalEvalPropKeyTypeAlias · 0.85
AsPropKeySetMethod · 0.80
ContainsMethod · 0.65
EqualMethod · 0.65
KeyMethod · 0.65
DescMethod · 0.65
RemoveMethod · 0.65
IsEmptyMethod · 0.45

Tested by

no test coverage detected