(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestSSE(t *testing.T) { |
| 15 | cases := []struct { |
| 16 | Name string |
| 17 | DSL func() |
| 18 | }{ |
| 19 | {"string", testdata.SSEStringDSL}, |
| 20 | {"int", testdata.SSEIntDSL}, |
| 21 | {"bool", testdata.SSEBoolDSL}, |
| 22 | {"object", testdata.SSEObjectDSL}, |
| 23 | {"data-field", testdata.SSEDataFieldDSL}, |
| 24 | {"data-id-field", testdata.SSEDataIDFieldDSL}, |
| 25 | {"request-id", testdata.SSERequestIDDSL}, |
| 26 | {"all-fields", testdata.SSEAllFieldsDSL}, |
| 27 | } |
| 28 | |
| 29 | for _, c := range cases { |
| 30 | t.Run(c.Name, func(t *testing.T) { |
| 31 | root := RunHTTPDSL(t, c.DSL) |
| 32 | services := CreateHTTPServices(root) |
| 33 | fs := ServerFiles("", services) |
| 34 | require.Len(t, fs, 3) |
| 35 | sections := fs[1].SectionTemplates |
| 36 | require.Greater(t, len(sections), 1) |
| 37 | code := codegen.SectionCode(t, sections[1]) |
| 38 | golden := filepath.Join("testdata", "golden", "sse-"+c.Name+".golden") |
| 39 | testutil.CompareOrUpdateGolden(t, code, golden) |
| 40 | }) |
| 41 | } |
| 42 | } |
nothing calls this directly
no test coverage detected