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

Function TestCompileYAMLPolicy_ConditionAlwaysFalse

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

Source from the content-addressed store, hash-verified

844}
845
846func TestCompileYAMLPolicy_ConditionAlwaysFalse(t *testing.T) {
847 policySource := `name: condition_always_false
848rule:
849 aggregate:
850 - condition: 'false'
851 output: "'foo'"`
852 _, _, iss := parseAndCompilePolicy(t, "condition_always_false", policySource, nil, nil)
853 if iss.Err() == nil {
854 t.Fatalf("Compile() succeeded, wanted error")
855 }
856 if !strings.Contains(iss.Err().Error(), "Condition is always false") {
857 t.Errorf("Compile() got %v, wanted 'Condition is always false'", iss.Err())
858 }
859}

Callers

nothing calls this directly

Calls 4

parseAndCompilePolicyFunction · 0.85
ErrMethod · 0.80
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected