(t testing.TB, name string, parseOpts []ParserOption)
| 487 | } |
| 488 | |
| 489 | func parsePolicy(t testing.TB, name string, parseOpts []ParserOption) *Policy { |
| 490 | t.Helper() |
| 491 | srcFile := readPolicy(t, fmt.Sprintf("testdata/%s/policy.yaml", name)) |
| 492 | parser, err := NewParser(parseOpts...) |
| 493 | if err != nil { |
| 494 | t.Fatalf("NewParser() failed: %v", err) |
| 495 | } |
| 496 | policy, iss := parser.Parse(srcFile) |
| 497 | if iss.Err() != nil { |
| 498 | t.Fatalf("Parse() failed: %v", iss.Err()) |
| 499 | } |
| 500 | if policy.name.Value != name { |
| 501 | t.Errorf("policy name is %v, wanted %q", policy.name, name) |
| 502 | } |
| 503 | return policy |
| 504 | } |
| 505 | |
| 506 | func compile(t testing.TB, name string, policy *Policy, envOpts []cel.EnvOption, compilerOpts []CompilerOption) (*cel.Env, *cel.Ast, *cel.Issues) { |
| 507 | config := readPolicyConfig(t, fmt.Sprintf("testdata/%s/config.yaml", name)) |
no test coverage detected