testProtosEnv initializes the test environment common to all tests.
(t *testing.T, opts ...cel.EnvOption)
| 211 | |
| 212 | // testProtosEnv initializes the test environment common to all tests. |
| 213 | func 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 | |
| 229 | func TestProtosWithExtension(t *testing.T) { |
| 230 | env := testProtosEnv(t) |
no test coverage detected