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

Function TestCheckedExprToAstConstantExpr

cel/io_test.go:270–288  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

268}
269
270func TestCheckedExprToAstConstantExpr(t *testing.T) {
271 stdEnv, err := NewEnv()
272 if err != nil {
273 t.Fatalf("NewEnv() failed: %v", err)
274 }
275 in := "10"
276 ast, iss := stdEnv.Compile(in)
277 if iss.Err() != nil {
278 t.Fatalf("stdEnv.Compile(%q) failed: %v", in, iss.Err())
279 }
280 expr, err := AstToCheckedExpr(ast)
281 if err != nil {
282 t.Fatalf("AstToCheckedExpr(ast) failed: %v", err)
283 }
284 ast2 := CheckedExprToAst(expr)
285 if !proto.Equal(ast2.Expr(), ast.Expr()) {
286 t.Fatalf("got ast %v, wanted %v", ast2, ast)
287 }
288}
289
290func TestCheckedExprToAstMissingInfo(t *testing.T) {
291 stdEnv, err := NewEnv()

Callers

nothing calls this directly

Calls 8

CompileMethod · 0.95
ExprInterface · 0.92
AstToCheckedExprFunction · 0.85
CheckedExprToAstFunction · 0.85
ErrMethod · 0.80
NewEnvFunction · 0.70
EqualMethod · 0.65
ExprMethod · 0.65

Tested by

no test coverage detected