(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestClientInit(t *testing.T) { |
| 14 | cases := []struct { |
| 15 | Name string |
| 16 | DSL func() |
| 17 | FileCount int |
| 18 | SectionNum int |
| 19 | }{ |
| 20 | {"multiple endpoints", testdata.ServerMultiEndpointsDSL, 2, 2}, |
| 21 | {"streaming", testdata.StreamingResultDSL, 3, 2}, |
| 22 | } |
| 23 | for _, c := range cases { |
| 24 | t.Run(c.Name, func(t *testing.T) { |
| 25 | root := RunHTTPDSL(t, c.DSL) |
| 26 | services := CreateHTTPServices(root) |
| 27 | fs := ClientFiles("", services) |
| 28 | require.Len(t, fs, c.FileCount) |
| 29 | sections := fs[0].SectionTemplates |
| 30 | require.Greater(t, len(sections), c.SectionNum) |
| 31 | code := codegen.SectionCode(t, sections[c.SectionNum]) |
| 32 | testutil.AssertGo(t, "testdata/golden/client_init_"+c.Name+".go.golden", code) |
| 33 | }) |
| 34 | } |
| 35 | } |
nothing calls this directly
no test coverage detected