(t *testing.T)
| 813 | } |
| 814 | |
| 815 | func TestCompiledRuleSemantic(t *testing.T) { |
| 816 | policySource := `name: aggregate_semantic |
| 817 | rule: |
| 818 | aggregate: |
| 819 | - condition: 'true' |
| 820 | output: "'foo'"` |
| 821 | policy := parsePolicySource(t, "aggregate_semantic", policySource) |
| 822 | env, err := cel.NewEnv() |
| 823 | if err != nil { |
| 824 | t.Fatalf("cel.NewEnv() failed: %v", err) |
| 825 | } |
| 826 | compiledRule, iss := CompileRule(env, policy) |
| 827 | if iss.Err() != nil { |
| 828 | t.Fatalf("CompileRule() failed: %v", iss.Err()) |
| 829 | } |
| 830 | if compiledRule.Semantic() != aggregate { |
| 831 | t.Errorf("got %v, wanted aggregate", compiledRule.Semantic()) |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | func TestCompileYAMLPolicy_ConditionAlwaysFalse(t *testing.T) { |
| 836 | policySource := `name: condition_always_false |
nothing calls this directly
no test coverage detected