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

Function TestCheckedExprToAstConstantExpr

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

Source from the content-addressed store, hash-verified

309}
310
311func TestCheckedExprToAstConstantExpr(t *testing.T) {
312 stdEnv, err := NewEnv()
313 if err != nil {
314 t.Fatalf("NewEnv() failed: %v", err)
315 }
316 in := "10"
317 ast, iss := stdEnv.Compile(in)
318 if iss.Err() != nil {
319 t.Fatalf("stdEnv.Compile(%q) failed: %v", in, iss.Err())
320 }
321 expr, err := AstToCheckedExpr(ast)
322 if err != nil {
323 t.Fatalf("AstToCheckedExpr(ast) failed: %v", err)
324 }
325 ast2 := CheckedExprToAst(expr)
326 if !proto.Equal(ast2.Expr(), ast.Expr()) {
327 t.Fatalf("got ast %v, wanted %v", ast2, ast)
328 }
329}
330
331func TestCheckedExprToAstMissingInfo(t *testing.T) {
332 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