(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func TestEncodeMarshallingAndUnmarshalling(t *testing.T) { |
| 106 | cases := []struct { |
| 107 | Name string |
| 108 | DSL func() |
| 109 | SectionCount int |
| 110 | SectionsOffset int |
| 111 | }{ |
| 112 | {"embedded-custom-pkg-type", testdata.EmbeddedCustomPkgTypeDSL, 2, 3}, |
| 113 | {"array-alias-extended", testdata.ArrayAliasExtendedDSL, 2, 3}, |
| 114 | {"extension-with-alias", testdata.ExtensionWithAliasDSL, 5, 4}, |
| 115 | } |
| 116 | for _, c := range cases { |
| 117 | t.Run(c.Name, func(t *testing.T) { |
| 118 | root := RunHTTPDSL(t, c.DSL) |
| 119 | services := CreateHTTPServices(root) |
| 120 | fs := ServerFiles("", services) |
| 121 | require.Len(t, fs, 2) |
| 122 | sections := fs[1].SectionTemplates |
| 123 | totalSectionsExpected := c.SectionsOffset + c.SectionCount |
| 124 | require.Len(t, sections, totalSectionsExpected) |
| 125 | for i := 0; i < c.SectionCount; i++ { |
| 126 | code := codegen.SectionCode(t, sections[c.SectionsOffset+i]) |
| 127 | testutil.AssertGo(t, "testdata/golden/server_encode_marshal_"+c.Name+"_section"+string(rune('0'+i))+".go.golden", code) |
| 128 | } |
| 129 | }) |
| 130 | } |
| 131 | } |
nothing calls this directly
no test coverage detected