(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestFilesDSL(t *testing.T) { |
| 12 | cases := []struct { |
| 13 | Name string |
| 14 | DSL func() |
| 15 | Error string |
| 16 | }{ |
| 17 | {Name: "valid", DSL: testdata.FilesValidDSL}, |
| 18 | {Name: "incompatible", DSL: testdata.FilesIncompatibleDSL, Error: "invalid use of Files in API files-incompatile"}, |
| 19 | {Name: "too many arg error", DSL: testdata.FilesTooManyArgErrorDSL, Error: "too many arguments given to Files in API files-too-many-arg-error"}, |
| 20 | } |
| 21 | for _, c := range cases { |
| 22 | t.Run(c.Name, func(t *testing.T) { |
| 23 | if c.Error == "" { |
| 24 | expr.RunDSL(t, c.DSL) |
| 25 | } else { |
| 26 | err := expr.RunInvalidDSL(t, c.DSL) |
| 27 | if !strings.HasSuffix(err.Error(), c.Error) { |
| 28 | t.Errorf("got error %q, expected has suffix %q", err.Error(), c.Error) |
| 29 | } |
| 30 | } |
| 31 | }) |
| 32 | } |
| 33 | } |
nothing calls this directly
no test coverage detected