(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestClientCLIFiles(t *testing.T) { |
| 15 | cases := []struct { |
| 16 | Name string |
| 17 | DSL func() |
| 18 | }{ |
| 19 | {"payload-with-validations", testdata.PayloadWithValidationsDSL}, |
| 20 | } |
| 21 | |
| 22 | for _, c := range cases { |
| 23 | t.Run(c.Name, func(t *testing.T) { |
| 24 | root := RunGRPCDSL(t, c.DSL) |
| 25 | services := CreateGRPCServices(root) |
| 26 | fs := ClientCLIFiles("", services) |
| 27 | require.Greater(t, len(fs), 1, "expected at least 2 files") |
| 28 | require.NotEmpty(t, fs[1].SectionTemplates) |
| 29 | var buf bytes.Buffer |
| 30 | for _, s := range fs[1].SectionTemplates { |
| 31 | require.NoError(t, s.Write(&buf)) |
| 32 | } |
| 33 | code := codegen.FormatTestCode(t, buf.String()) |
| 34 | testutil.AssertGo(t, "testdata/golden/client_cli_"+c.Name+".go.golden", code) |
| 35 | }) |
| 36 | } |
| 37 | } |
nothing calls this directly
no test coverage detected