(t *testing.T)
| 52 | } |
| 53 | |
| 54 | func TestTooFewArgError(t *testing.T) { |
| 55 | dsls := map[string]func(){ |
| 56 | "Body": func() { Body() }, |
| 57 | "ErrorName": func() { ErrorName() }, |
| 58 | "ErrorName (int)": func() { Type("name", func() { ErrorName(1) }) }, |
| 59 | "Example": func() { Example() }, |
| 60 | "OneOf": func() { OneOf("name") }, |
| 61 | "Response (grpc)": func() { Service("s", func() { GRPC(func() { Response("name") }) }) }, |
| 62 | "Response (http)": func() { Service("s", func() { HTTP(func() { Response("name") }) }) }, |
| 63 | } |
| 64 | for name, dsl := range dsls { |
| 65 | t.Run(name, func(t *testing.T) { |
| 66 | err := expr.RunInvalidDSL(t, dsl) |
| 67 | assert.Len(t, strings.Split(err.Error(), "\n"), 1) |
| 68 | assert.Contains(t, err.Error(), "too few arguments given to "+strings.Split(name, " ")[0]) |
| 69 | }) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | func TestTooManyArgError(t *testing.T) { |
| 74 | dsls := map[string]func(){ |
nothing calls this directly
no test coverage detected