(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestPathTrailingShash(t *testing.T) { |
| 49 | cases := []struct { |
| 50 | Name string |
| 51 | DSL func() |
| 52 | }{ |
| 53 | {"slash_with_base_path_no_trailing", testdata.BasePathNoTrailing_SlashWithBasePathNoTrailingDSL}, |
| 54 | {"trailing_with_base_path_no_trailing", testdata.BasePathNoTrailing_TrailingWithBasePathNoTrailingDSL}, |
| 55 | {"slash_with_base_path_with_trailing", testdata.BasePathWithTrailingSlash_WithBasePathWithTrailingDSL}, |
| 56 | {"slash_no_base_path", testdata.NoBasePath_SlashNoBasePathDSL}, |
| 57 | {"path-trailing_no_base_path", testdata.NoBasePath_TrailingNoBasePathDSL}, |
| 58 | {"add-trailing-slash-to-base-path", testdata.BasePath_SpecialTrailingSlashDSL}, |
| 59 | } |
| 60 | |
| 61 | for _, c := range cases { |
| 62 | t.Run(c.Name, func(t *testing.T) { |
| 63 | root := RunHTTPDSL(t, c.DSL) |
| 64 | require.Len(t, root.API.HTTP.Services, 1) |
| 65 | services := CreateHTTPServices(root) |
| 66 | fs := serverPath(root.API.HTTP.Services[0], services) |
| 67 | sections := fs.SectionTemplates |
| 68 | code := codegen.SectionCode(t, sections[1]) |
| 69 | testutil.AssertGo(t, "testdata/golden/paths_"+c.Name+".go.golden", code) |
| 70 | }) |
| 71 | } |
| 72 | } |
nothing calls this directly
no test coverage detected