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

Function TestParse

policy/parser_test.go:28–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestParse(t *testing.T) {
29 for _, tst := range policyTests {
30 srcFile := readPolicy(t, fmt.Sprintf("testdata/%s/policy.yaml", tst.name))
31 parser, err := NewParser(tst.parseOpts...)
32 if err != nil {
33 t.Fatalf("NewParser() failed: %v", err)
34 }
35 p, iss := parser.Parse(srcFile)
36 if iss.Err() != nil {
37 t.Fatalf("parser.Parse() failed: %v", iss.Err())
38 }
39 if p.Name().Value != tst.name {
40 t.Errorf("policy name is %v, wanted %q", p.name, tst.name)
41 }
42 }
43}
44
45func TestParseError(t *testing.T) {
46 tests := []struct {

Callers

nothing calls this directly

Calls 5

ParseMethod · 0.95
readPolicyFunction · 0.85
ErrMethod · 0.80
NewParserFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected