Add test to verify JSON fields section is rendered
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
This commit is contained in:
parent
b445adae20
commit
5b99a4a2ec
1 changed files with 16 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue