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

Function TestFunctions

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

Source from the content-addressed store, hash-verified

305}
306
307func TestFunctions(t *testing.T) {
308 e, err := NewEnv(OptionalTypes())
309 if err != nil {
310 t.Fatalf("NewEnv() failed: %v", err)
311 }
312 for _, expected := range []string{"optional.of", "or"} {
313 if !e.HasFunction(expected) {
314 t.Errorf("Expected HasFunction() to return true for '%s'", expected)
315 }
316
317 if _, ok := e.Functions()[expected]; !ok {
318 t.Errorf("Expected Functions() to include '%s'", expected)
319 }
320 }
321}
322
323func TestEnvToConfig(t *testing.T) {
324 tests := []struct {

Callers

nothing calls this directly

Calls 4

HasFunctionMethod · 0.95
FunctionsMethod · 0.95
OptionalTypesFunction · 0.85
NewEnvFunction · 0.70

Tested by

no test coverage detected