MCPcopy Create free account
hub / github.com/goadesign/goa / TestEncodeMarshallingAndUnmarshalling

Function TestEncodeMarshallingAndUnmarshalling

http/codegen/server_encode_test.go:105–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func 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}

Callers

nothing calls this directly

Calls 6

SectionCodeFunction · 0.92
AssertGoFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
ServerFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected