(t *testing.T)
| 45 | } |
| 46 | |
| 47 | func TestRequestEncoder(t *testing.T) { |
| 48 | cases := []struct { |
| 49 | Name string |
| 50 | DSL func() |
| 51 | }{ |
| 52 | {"request-encoder-payload-user-type", testdata.MessageUserTypeWithNestedUserTypesDSL}, |
| 53 | {"request-encoder-payload-array", testdata.UnaryRPCNoResultDSL}, |
| 54 | {"request-encoder-payload-map", testdata.MessageMapDSL}, |
| 55 | {"request-encoder-payload-primitive", testdata.ServerStreamingRPCDSL}, |
| 56 | {"request-encoder-payload-primitive-with-streaming-payload", testdata.ClientStreamingRPCWithPayloadDSL}, |
| 57 | {"request-encoder-payload-user-type-with-streaming-payload", testdata.BidirectionalStreamingRPCWithPayloadDSL}, |
| 58 | {"request-encoder-payload-with-metadata", testdata.MessageWithMetadataDSL}, |
| 59 | {"request-encoder-payload-with-validate", testdata.MessageWithValidateDSL}, |
| 60 | {"request-encoder-payload-with-security-attributes", testdata.MessageWithSecurityAttrsDSL}, |
| 61 | } |
| 62 | for _, c := range cases { |
| 63 | t.Run(c.Name, func(t *testing.T) { |
| 64 | root := RunGRPCDSL(t, c.DSL) |
| 65 | services := CreateGRPCServices(root) |
| 66 | fs := ClientFiles("", services) |
| 67 | require.Len(t, fs, 2) |
| 68 | sections := fs[1].Section("request-encoder") |
| 69 | require.NotEmpty(t, sections) |
| 70 | code := codegen.SectionsCode(t, sections) |
| 71 | testutil.AssertGo(t, "testdata/golden/request_encoder_"+c.Name+".go.golden", code) |
| 72 | }) |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestResponseDecoder(t *testing.T) { |
| 77 | cases := []struct { |
nothing calls this directly
no test coverage detected