(t *testing.T)
| 255 | } |
| 256 | |
| 257 | func TestMethodExprValidateInterceptors(t *testing.T) { |
| 258 | cases := []struct { |
| 259 | Name string |
| 260 | DSL func() |
| 261 | Error string |
| 262 | }{ |
| 263 | {"no-interceptors", testdata.NoInterceptorsDSL, ""}, |
| 264 | {"valid-interceptors", testdata.ValidInterceptorsDSL, ""}, |
| 265 | {"duplicate-interceptors", testdata.DuplicateInterceptorsDSL, ""}, // Duplicates are handled by merging |
| 266 | {"mixed-interceptors", testdata.MixedInterceptorsDSL, ""}, |
| 267 | {"undefined-interceptor", testdata.UndefinedInterceptorDSL, |
| 268 | `ServerInterceptor: interceptor "undefined" not found in service "Service" method "Method"`}, |
| 269 | {"empty-interceptor-name", testdata.EmptyInterceptorNameDSL, |
| 270 | `ServerInterceptor: interceptor name cannot be empty`}, |
| 271 | } |
| 272 | |
| 273 | for _, c := range cases { |
| 274 | t.Run(c.Name, func(t *testing.T) { |
| 275 | if c.Error == "" { |
| 276 | expr.RunDSL(t, c.DSL) |
| 277 | return |
| 278 | } |
| 279 | err := expr.RunInvalidDSL(t, c.DSL) |
| 280 | assert.Contains(t, err.Error(), c.Error) |
| 281 | }) |
| 282 | } |
| 283 | } |
nothing calls this directly
no test coverage detected