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

Function TestMaxNestedExpressions_Error

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

Source from the content-addressed store, hash-verified

163}
164
165func TestMaxNestedExpressions_Error(t *testing.T) {
166 policyName := "limits"
167 wantError := `ERROR: testdata/limits/policy.yaml:15:8: error configuring compiler option: nested expression limit must be non-negative, non-zero value: -1
168 | name: "limits"
169 | .......^`
170 policy := parsePolicy(t, policyName, []ParserOption{})
171 _, _, iss := compile(t, policyName, policy, []cel.EnvOption{}, []CompilerOption{MaxNestedExpressions(-1)})
172 if iss.Err() == nil {
173 t.Fatalf("compile(%s) did not error, wanted %s", policyName, wantError)
174 }
175 if iss.Err().Error() != wantError {
176 t.Errorf("compile(%s) got error %s, wanted %s", policyName, iss.Err().Error(), wantError)
177 }
178}
179
180func TestWhitespaceHanlding(t *testing.T) {
181

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