(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestClientEndpointInit(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-acronym", testdata.UnaryRPCAcronymDSL}, |
| 23 | {"server-streaming-rpc", testdata.ServerStreamingRPCDSL}, |
| 24 | {"client-streaming-rpc", testdata.ClientStreamingRPCDSL}, |
| 25 | {"client-streaming-rpc-no-result", testdata.ClientStreamingNoResultDSL}, |
| 26 | {"client-streaming-rpc-with-payload", testdata.ClientStreamingRPCWithPayloadDSL}, |
| 27 | {"bidirectional-streaming-rpc", testdata.BidirectionalStreamingRPCDSL}, |
| 28 | {"bidirectional-streaming-rpc-with-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL}, |
| 29 | {"bidirectional-streaming-rpc-with-errors", testdata.BidirectionalStreamingRPCWithErrorsDSL}, |
| 30 | } |
| 31 | for _, c := range cases { |
| 32 | t.Run(c.Name, func(t *testing.T) { |
| 33 | root := RunGRPCDSL(t, c.DSL) |
| 34 | services := CreateGRPCServices(root) |
| 35 | fs := ClientFiles("", services) |
| 36 | require.Len(t, fs, 2) |
| 37 | sections := fs[0].Section("client-endpoint-init") |
| 38 | if len(sections) == 0 { |
| 39 | t.Fatalf("got zero sections, expected at least one") |
| 40 | } |
| 41 | code := codegen.SectionsCode(t, sections) |
| 42 | testutil.AssertGo(t, "testdata/golden/client_endpoint_init_"+c.Name+".go.golden", code) |
| 43 | }) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | func TestRequestEncoder(t *testing.T) { |
| 48 | cases := []struct { |
nothing calls this directly
no test coverage detected