(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func 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 | |
| 45 | func TestParseError(t *testing.T) { |
| 46 | tests := []struct { |
nothing calls this directly
no test coverage detected