(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestServerHandler(t *testing.T) { |
| 16 | const genpkg = "gen" |
| 17 | cases := []struct { |
| 18 | Name string |
| 19 | DSL func() |
| 20 | }{ |
| 21 | {"server simple routing", testdata.ServerSimpleRoutingDSL}, |
| 22 | {"server trailing slash routing", testdata.ServerTrailingSlashRoutingDSL}, |
| 23 | {"server simple routing with a redirect", testdata.ServerSimpleRoutingWithRedirectDSL}, |
| 24 | } |
| 25 | for _, c := range cases { |
| 26 | t.Run(c.Name, func(t *testing.T) { |
| 27 | root := RunHTTPDSL(t, c.DSL) |
| 28 | services := CreateHTTPServices(root) |
| 29 | fs := ServerFiles(genpkg, services) |
| 30 | sections := codegentest.Sections(fs, "server.go", "server-handler") |
| 31 | require.Greater(t, len(sections), 0) |
| 32 | code := codegen.SectionCode(t, sections[0]) |
| 33 | testutil.AssertGo(t, "testdata/golden/server_handler_"+c.Name+".go.golden", code) |
| 34 | }) |
| 35 | } |
| 36 | } |
nothing calls this directly
no test coverage detected