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

Function TestMaxNestedExpressions_Error

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

Source from the content-addressed store, hash-verified

117}
118
119func TestMaxNestedExpressions_Error(t *testing.T) {
120 policyName := "limits"
121 wantError := `ERROR: testdata/limits/policy.yaml:15:8: error configuring compiler option: nested expression limit must be non-negative, non-zero value: -1
122 | name: "limits"
123 | .......^`
124 policy := parsePolicy(t, policyName, []ParserOption{})
125 _, _, iss := compile(t, policyName, policy, []cel.EnvOption{}, []CompilerOption{MaxNestedExpressions(-1)})
126 if iss.Err() == nil {
127 t.Fatalf("compile(%s) did not error, wanted %s", policyName, wantError)
128 }
129 if iss.Err().Error() != wantError {
130 t.Errorf("compile(%s) got error %s, wanted %s", policyName, iss.Err().Error(), wantError)
131 }
132}
133
134func TestWhitespaceHanlding(t *testing.T) {
135

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected