(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestResponseEncoder(t *testing.T) { |
| 102 | cases := []struct { |
| 103 | Name string |
| 104 | DSL func() |
| 105 | }{ |
| 106 | {"response-encoder-empty-result", testdata.UnaryRPCNoResultDSL}, |
| 107 | {"response-encoder-result-with-views", testdata.MessageResultTypeWithViewsDSL}, |
| 108 | {"response-encoder-result-with-explicit-view", testdata.MessageResultTypeWithExplicitViewDSL}, |
| 109 | {"response-encoder-result-array", testdata.MessageArrayDSL}, |
| 110 | {"response-encoder-result-primitive", testdata.UnaryRPCNoPayloadDSL}, |
| 111 | {"response-encoder-result-with-metadata", testdata.MessageWithMetadataDSL}, |
| 112 | {"response-encoder-result-with-validate", testdata.MessageWithValidateDSL}, |
| 113 | {"response-encoder-result-collection", testdata.MessageResultTypeCollectionDSL}, |
| 114 | } |
| 115 | for _, c := range cases { |
| 116 | t.Run(c.Name, func(t *testing.T) { |
| 117 | root := RunGRPCDSL(t, c.DSL) |
| 118 | services := CreateGRPCServices(root) |
| 119 | fs := ServerFiles("", services) |
| 120 | require.Len(t, fs, 2) |
| 121 | sections := fs[1].Section("response-encoder") |
| 122 | require.NotEmpty(t, sections) |
| 123 | code := codegen.SectionsCode(t, sections) |
| 124 | testutil.AssertGo(t, "testdata/golden/response_encoder_"+c.Name+".go.golden", code) |
| 125 | }) |
| 126 | } |
| 127 | } |
nothing calls this directly
no test coverage detected