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

Function newTestEnv

common/ast/navigable_test.go:683–697  ·  view source on GitHub ↗
(t testing.TB, cont *containers.Container, reg *types.Registry, opts ...checker.Option)

Source from the content-addressed store, hash-verified

681}
682
683func newTestEnv(t testing.TB, cont *containers.Container, reg *types.Registry, opts ...checker.Option) *checker.Env {
684 t.Helper()
685 chkOpts := []checker.Option{checker.CrossTypeNumericComparisons(true)}
686 chkOpts = append(chkOpts, opts...)
687 env, err := checker.NewEnv(cont, reg, chkOpts...)
688 if err != nil {
689 t.Fatalf("checker.NewEnv(%v, %v) failed: %v", cont, reg, err)
690 }
691 err = env.AddFunctions(stdlib.Functions()...)
692 if err != nil {
693 t.Fatalf("env.Add(stdlib.Functions()...) failed: %v", err)
694 }
695 env.AddIdents(decls.NewVariable("msg", types.NewObjectType("google.expr.proto3.test.TestAllTypes")))
696 return env
697}

Callers 1

mustTypeCheckFunction · 0.70

Calls 7

AddFunctionsMethod · 0.95
AddIdentsMethod · 0.95
NewEnvFunction · 0.92
FunctionsFunction · 0.92
NewVariableFunction · 0.92
NewObjectTypeFunction · 0.92

Tested by

no test coverage detected