(t *testing.T)
| 42 | } |
| 43 | |
| 44 | func TestServerHandlerInit(t *testing.T) { |
| 45 | cases := []struct { |
| 46 | Name string |
| 47 | DSL func() |
| 48 | }{ |
| 49 | {"unary-rpcs", testdata.UnaryRPCsDSL}, |
| 50 | {"unary-rpc-no-payload", testdata.UnaryRPCNoPayloadDSL}, |
| 51 | {"unary-rpc-no-result", testdata.UnaryRPCNoResultDSL}, |
| 52 | {"server-streaming-rpc", testdata.ServerStreamingRPCDSL}, |
| 53 | {"client-streaming-rpc", testdata.ClientStreamingRPCDSL}, |
| 54 | {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL}, |
| 55 | {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL}, |
| 56 | {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL}, |
| 57 | } |
| 58 | for _, c := range cases { |
| 59 | t.Run(c.Name, func(t *testing.T) { |
| 60 | root := RunGRPCDSL(t, c.DSL) |
| 61 | services := CreateGRPCServices(root) |
| 62 | fs := ServerFiles("", services) |
| 63 | require.Len(t, fs, 2) |
| 64 | sections := fs[0].Section("grpc-handler-init") |
| 65 | require.NotEmpty(t, sections) |
| 66 | code := codegen.SectionsCode(t, sections) |
| 67 | testutil.AssertGo(t, "testdata/golden/server_handler_init_"+c.Name+".go.golden", code) |
| 68 | }) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func TestRequestDecoder(t *testing.T) { |
| 73 | cases := []struct { |
nothing calls this directly
no test coverage detected