MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestEnvCheckExtendRace

Function TestEnvCheckExtendRace

cel/env_test.go:167–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

165}
166
167func TestEnvCheckExtendRace(t *testing.T) {
168 t.Parallel()
169 for i := 0; i < 500; i++ {
170 wg := &sync.WaitGroup{}
171 wg.Add(2)
172 env, err := NewCustomEnv(StdLib())
173 if err != nil {
174 t.Fatalf("NewCustomEnv() failed: %v", err)
175 }
176 t.Run(fmt.Sprintf("Compile[%d]", i), func(t *testing.T) {
177 go func() {
178 defer wg.Done()
179 _, _ = env.Compile(`1 + 1 * 20 < 400`)
180 }()
181 })
182 t.Run(fmt.Sprintf("Extend[%d]", i), func(t *testing.T) {
183 go func() {
184 defer wg.Done()
185 _, _ = env.Extend(Variable("bar", BoolType))
186 }()
187 })
188 wg.Wait()
189 }
190}
191
192func TestEnvPartialVarsError(t *testing.T) {
193 env := testEnv(t)

Callers

nothing calls this directly

Calls 6

NewCustomEnvFunction · 0.85
StdLibFunction · 0.85
VariableFunction · 0.70
AddMethod · 0.65
CompileMethod · 0.65
ExtendMethod · 0.45

Tested by

no test coverage detected