(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestClientDecode(t *testing.T) { |
| 14 | cases := []struct { |
| 15 | Name string |
| 16 | DSL func() |
| 17 | }{ |
| 18 | {"empty-body", testdata.EmptyServerResponseDSL}, |
| 19 | {"body-result-multiple-views", testdata.ResultBodyMultipleViewsDSL}, |
| 20 | {"empty-body-result-multiple-views", testdata.EmptyBodyResultMultipleViewsDSL}, |
| 21 | {"explicit-body-primitive-result", testdata.ExplicitBodyPrimitiveResultMultipleViewsDSL}, |
| 22 | {"explicit-body-result-multiple-views", testdata.ExplicitBodyUserResultMultipleViewsDSL}, |
| 23 | {"explicit-body-result-collection", testdata.ExplicitBodyResultCollectionDSL}, |
| 24 | {"tag-result-multiple-views", testdata.ResultMultipleViewsTagDSL}, |
| 25 | {"empty-server-response-with-tags", testdata.EmptyServerResponseWithTagsDSL}, |
| 26 | {"header-string-implicit", testdata.ResultHeaderStringImplicitDSL}, |
| 27 | {"header-string-array", testdata.ResultHeaderStringArrayDSL}, |
| 28 | {"header-string-array-validate", testdata.ResultHeaderStringArrayValidateDSL}, |
| 29 | {"header-array", testdata.ResultHeaderArrayDSL}, |
| 30 | {"header-array-validate", testdata.ResultHeaderArrayValidateDSL}, |
| 31 | {"with-headers-dsl", testdata.WithHeadersBlockDSL}, |
| 32 | {"with-headers-dsl-viewed-result", testdata.WithHeadersBlockViewedResultDSL}, |
| 33 | {"validate-error-response-type", testdata.ValidateErrorResponseTypeDSL}, |
| 34 | {"empty-error-response-body", testdata.EmptyErrorResponseBodyDSL}, |
| 35 | } |
| 36 | for _, c := range cases { |
| 37 | t.Run(c.Name, func(t *testing.T) { |
| 38 | root := RunHTTPDSL(t, c.DSL) |
| 39 | services := CreateHTTPServices(root) |
| 40 | fs := ClientFiles("", services) |
| 41 | require.Len(t, fs, 2) |
| 42 | sections := fs[1].SectionTemplates |
| 43 | require.Greater(t, len(sections), 2) |
| 44 | code := codegen.SectionCode(t, sections[2]) |
| 45 | testutil.AssertGo(t, "testdata/golden/client_decode_"+c.Name+".go.golden", code) |
| 46 | }) |
| 47 | } |
| 48 | } |
nothing calls this directly
no test coverage detected