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

Function TestCompileError

policy/compiler_test.go:95–106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestCompileError(t *testing.T) {
96 for _, tst := range policyErrorTests {
97 policy := parsePolicy(t, tst.name, []ParserOption{})
98 _, _, iss := compile(t, tst.name, policy, []cel.EnvOption{}, tst.compilerOpts)
99 if iss.Err() == nil {
100 t.Fatalf("compile(%s) did not error, wanted %s", tst.name, tst.err)
101 }
102 if iss.Err().Error() != tst.err {
103 t.Errorf("compile(%s) got error %s, wanted %s", tst.name, iss.Err().Error(), tst.err)
104 }
105 }
106}
107
108func TestCompiledRuleHasOptionalOutput(t *testing.T) {
109 env, err := cel.NewEnv()

Callers

nothing calls this directly

Calls 4

parsePolicyFunction · 0.85
ErrMethod · 0.80
compileFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected