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

Function TestEnvConcurrentExtend

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

Source from the content-addressed store, hash-verified

220}
221
222func TestEnvConcurrentExtend(t *testing.T) {
223 t.Parallel()
224 baseEnv, err := NewCustomEnv(StdLib())
225 if err != nil {
226 t.Fatalf("NewCustomEnv() failed: %v", err)
227 }
228 var wg sync.WaitGroup
229 for i := 0; i < 50; i++ {
230 wg.Add(1)
231 go func(id int) {
232 defer wg.Done()
233 _, err := baseEnv.Extend(Variable(fmt.Sprintf("v%d", id), StringType))
234 if err != nil {
235 t.Errorf("Extend() failed: %v", err)
236 }
237 }(i)
238 }
239 wg.Wait()
240}
241
242func TestEnvConcurrentExtendAndCompile(t *testing.T) {
243 t.Parallel()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected