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

Function TestCompileError

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

Source from the content-addressed store, hash-verified

47}
48
49func TestCompileError(t *testing.T) {
50 for _, tst := range policyErrorTests {
51 policy := parsePolicy(t, tst.name, []ParserOption{})
52 _, _, iss := compile(t, tst.name, policy, []cel.EnvOption{}, tst.compilerOpts)
53 if iss.Err() == nil {
54 t.Fatalf("compile(%s) did not error, wanted %s", tst.name, tst.err)
55 }
56 if iss.Err().Error() != tst.err {
57 t.Errorf("compile(%s) got error %s, wanted %s", tst.name, iss.Err().Error(), tst.err)
58 }
59 }
60}
61
62func TestCompiledRuleHasOptionalOutput(t *testing.T) {
63 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