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

Function parsePolicySource

policy/compiler_test.go:247–259  ·  view source on GitHub ↗
(t testing.TB, name string, policySource string, parseOpts ...ParserOption)

Source from the content-addressed store, hash-verified

245}
246
247func parsePolicySource(t testing.TB, name string, policySource string, parseOpts ...ParserOption) *Policy {
248 t.Helper()
249 p := StringSource(policySource, name)
250 parser, err := NewParser(parseOpts...)
251 if err != nil {
252 t.Fatalf("NewParser() failed: %v", err)
253 }
254 policy, iss := parser.Parse(p)
255 if iss.Err() != nil {
256 t.Fatalf("parser.Parse() failed: %v", iss.Err())
257 }
258 return policy
259}
260
261func parseAndCompilePolicy(t testing.TB, name string, policySource string, envOpts []cel.EnvOption, compilerOpts []CompilerOption) (*cel.Env, *cel.Ast, *cel.Issues) {
262 t.Helper()

Callers 2

parseAndCompilePolicyFunction · 0.85
TestCompiledRuleSemanticFunction · 0.85

Calls 4

ParseMethod · 0.95
StringSourceFunction · 0.85
ErrMethod · 0.80
NewParserFunction · 0.70

Tested by

no test coverage detected