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

Function TestFunctions

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

Source from the content-addressed store, hash-verified

443}
444
445func TestFunctions(t *testing.T) {
446 e, err := NewEnv(OptionalTypes())
447 if err != nil {
448 t.Fatalf("NewEnv() failed: %v", err)
449 }
450 for _, expected := range []string{"optional.of", "or"} {
451 if !e.HasFunction(expected) {
452 t.Errorf("Expected HasFunction() to return true for '%s'", expected)
453 }
454
455 if _, ok := e.Functions()[expected]; !ok {
456 t.Errorf("Expected Functions() to include '%s'", expected)
457 }
458 }
459}
460
461func TestEnvToConfig(t *testing.T) {
462 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