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

Function TestPaths

http/codegen/paths_test.go:13–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestPaths(t *testing.T) {
14 cases := []struct {
15 Name string
16 DSL func()
17 }{
18 {"single-path-no-param", testdata.PathNoParamDSL},
19 {"single-path-one-param", testdata.PathOneParamDSL},
20 {"single-path-multiple-params", testdata.PathMultipleParamsDSL},
21 {"alternative-paths", testdata.PathAlternativesDSL},
22 {"path-with-string-slice-param", testdata.PathStringSliceParamDSL},
23 {"path-with-int-slice-param", testdata.PathIntSliceParamDSL},
24 {"path-with-int32-slice-param", testdata.PathInt32SliceParamDSL},
25 {"path-with-int64-slice-param", testdata.PathInt64SliceParamDSL},
26 {"path-with-uint-slice-param", testdata.PathUintSliceParamDSL},
27 {"path-with-uint32-slice-param", testdata.PathUint32SliceParamDSL},
28 {"path-with-uint64-slice-param", testdata.PathUint64SliceParamDSL},
29 {"path-with-float33-slice-param", testdata.PathFloat32SliceParamDSL},
30 {"path-with-float64-slice-param", testdata.PathFloat64SliceParamDSL},
31 {"path-with-bool-slice-param", testdata.PathBoolSliceParamDSL},
32 {"path-with-interface-slice-param", testdata.PathInterfaceSliceParamDSL},
33 }
34
35 for _, c := range cases {
36 t.Run(c.Name, func(t *testing.T) {
37 root := RunHTTPDSL(t, c.DSL)
38 require.Len(t, root.API.HTTP.Services, 1)
39 services := CreateHTTPServices(root)
40 fs := serverPath(root.API.HTTP.Services[0], services)
41 sections := fs.SectionTemplates
42 code := codegen.SectionCode(t, sections[1])
43 testutil.AssertGo(t, "testdata/golden/paths_"+c.Name+".go.golden", code)
44 })
45 }
46}
47
48func TestPathTrailingShash(t *testing.T) {
49 cases := []struct {

Callers

nothing calls this directly

Calls 6

SectionCodeFunction · 0.92
AssertGoFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
serverPathFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected