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

Function TestRawExpressionCreateAst

tools/compiler/compiler_test.go:397–415  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

395}
396
397func TestRawExpressionCreateAst(t *testing.T) {
398 t.Run("test raw expression create ast", func(t *testing.T) {
399 envOpt := EnvironmentFile("testdata/config.yaml")
400 compiler, err := NewCompiler(envOpt)
401 if err != nil {
402 t.Fatalf("NewCompiler() failed: %v", err)
403 }
404 rawExpr := &RawExpression{
405 Value: "locationCode(destination.ip)==locationCode(origin.ip)",
406 }
407 ast, _, err := rawExpr.CreateAST(compiler)
408 if err != nil {
409 t.Fatalf("CreateAST() failed: %v", err)
410 }
411 if ast == nil {
412 t.Fatalf("CreateAST() returned nil ast")
413 }
414 })
415}

Callers

nothing calls this directly

Calls 3

CreateASTMethod · 0.95
EnvironmentFileFunction · 0.85
NewCompilerFunction · 0.85

Tested by

no test coverage detected