diff --git a/internal/docs/man_test.go b/internal/docs/man_test.go index fb595d17d..287f356ed 100644 --- a/internal/docs/man_test.go +++ b/internal/docs/man_test.go @@ -98,6 +98,22 @@ func TestGenManSeeAlso(t *testing.T) { } } +func TestGenManJSONFields(t *testing.T) { + buf := new(bytes.Buffer) + header := &GenManHeader{} + if err := renderMan(jsonCmd, header, buf); err != nil { + t.Fatal(err) + } + + output := buf.String() + + checkStringContains(t, output, translate(jsonCmd.Name())) + checkStringContains(t, output, "JSON FIELDS") + checkStringContains(t, output, "foo") + checkStringContains(t, output, "bar") + checkStringContains(t, output, "baz") +} + func TestManPrintFlagsHidesShortDeprecated(t *testing.T) { c := &cobra.Command{} c.Flags().StringP("foo", "f", "default", "Foo flag")