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

Function TestNilProgram

cel/cel_test.go:1389–1404  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1387}
1388
1389func TestNilProgram(t *testing.T) {
1390 var prg Program = (*prog)(nil)
1391
1392 if _, _, err := prg.Eval(NoVars()); err == nil || !strings.Contains(err.Error(), "program is nil") {
1393 t.Errorf("prg.Eval() got error %v, wanted error containing 'program is nil'", err)
1394 }
1395
1396 if _, _, err := prg.ContextEval(context.Background(), NoVars()); err == nil || !strings.Contains(err.Error(), "program is nil") {
1397 t.Errorf("prg.ContextEval() got error %v, wanted error containing 'program is nil'", err)
1398 }
1399
1400 res := <-prg.ConcurrentEval(context.Background(), NoVars())
1401 if res.Err == nil || !strings.Contains(res.Err.Error(), "program is nil") {
1402 t.Errorf("prg.ConcurrentEval() got error %v, wanted error containing 'program is nil'", res.Err)
1403 }
1404}
1405
1406func TestResidualAst(t *testing.T) {
1407 env := testEnv(t,

Callers

nothing calls this directly

Calls 6

EvalMethod · 0.95
ContextEvalMethod · 0.95
ConcurrentEvalMethod · 0.95
NoVarsFunction · 0.85
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected