(t testing.TB, env *Env, expr string)
| 4104 | } |
| 4105 | |
| 4106 | func compileOrError(t testing.TB, env *Env, expr string) (Program, error) { |
| 4107 | t.Helper() |
| 4108 | ast, iss := env.Compile(expr) |
| 4109 | if iss.Err() != nil { |
| 4110 | return nil, fmt.Errorf("env.Compile(%s) failed: %v", expr, iss.Err()) |
| 4111 | } |
| 4112 | prg, err := env.Program(ast, EvalOptions(OptOptimize)) |
| 4113 | if err != nil { |
| 4114 | return nil, fmt.Errorf("env.Program() failed: %v", err) |
| 4115 | } |
| 4116 | return prg, nil |
| 4117 | } |
| 4118 | |
| 4119 | func interpret(t testing.TB, env *Env, expr string, vars any) (ref.Val, error) { |
| 4120 | t.Helper() |
no test coverage detected