(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestServerGRPCInterface(t *testing.T) { |
| 14 | cases := []struct { |
| 15 | Name string |
| 16 | DSL func() |
| 17 | }{ |
| 18 | {"unary-rpcs", testdata.UnaryRPCsDSL}, |
| 19 | {"unary-rpc-no-payload", testdata.UnaryRPCNoPayloadDSL}, |
| 20 | {"unary-rpc-no-result", testdata.UnaryRPCNoResultDSL}, |
| 21 | {"unary-rpc-with-errors", testdata.UnaryRPCWithErrorsDSL}, |
| 22 | {"unary-rpc-with-overriding-errors", testdata.UnaryRPCWithOverridingErrorsDSL}, |
| 23 | {"server-streaming-rpc", testdata.ServerStreamingRPCDSL}, |
| 24 | {"client-streaming-rpc", testdata.ClientStreamingRPCDSL}, |
| 25 | {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL}, |
| 26 | {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL}, |
| 27 | {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL}, |
| 28 | {"bidirectional-streaming-rpc-with-errors", testdata.BidirectionalStreamingRPCWithErrorsDSL}, |
| 29 | } |
| 30 | for _, c := range cases { |
| 31 | t.Run(c.Name, func(t *testing.T) { |
| 32 | root := RunGRPCDSL(t, c.DSL) |
| 33 | services := CreateGRPCServices(root) |
| 34 | fs := ServerFiles("", services) |
| 35 | require.Len(t, fs, 2) |
| 36 | sections := fs[0].Section("server-grpc-interface") |
| 37 | require.NotEmpty(t, sections) |
| 38 | code := codegen.SectionsCode(t, sections) |
| 39 | testutil.AssertGo(t, "testdata/golden/server_grpc_interface_"+c.Name+".go.golden", code) |
| 40 | }) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestServerHandlerInit(t *testing.T) { |
| 45 | cases := []struct { |
nothing calls this directly
no test coverage detected