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

Function testProtosEnv

ext/protos_test.go:213–227  ·  view source on GitHub ↗

testProtosEnv initializes the test environment common to all tests.

(t *testing.T, opts ...cel.EnvOption)

Source from the content-addressed store, hash-verified

211
212// testProtosEnv initializes the test environment common to all tests.
213func testProtosEnv(t *testing.T, opts ...cel.EnvOption) *cel.Env {
214 t.Helper()
215 baseOpts := []cel.EnvOption{
216 cel.Container("google.expr.proto2.test"),
217 cel.Types(&proto2pb.ExampleType{}, &proto2pb.ExternalMessageType{}),
218 cel.Variable("msg", cel.ObjectType("google.expr.proto2.test.ExampleType")),
219 cel.EnableIdentifierEscapeSyntax(),
220 Protos(),
221 }
222 env, err := cel.NewEnv(append(baseOpts, opts...)...)
223 if err != nil {
224 t.Fatalf("cel.NewEnv(Protos()) failed: %v", err)
225 }
226 return env
227}
228
229func TestProtosWithExtension(t *testing.T) {
230 env := testProtosEnv(t)

Callers 4

TestProtosFunction · 0.85
TestProtosNonMatchFunction · 0.85
TestProtosParseErrorsFunction · 0.85
TestProtosWithExtensionFunction · 0.85

Calls 6

ContainerFunction · 0.92
TypesFunction · 0.92
VariableFunction · 0.92
NewEnvFunction · 0.92
ProtosFunction · 0.85

Tested by

no test coverage detected