Add test to verify JSON fields section is rendered in Markdown
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
This commit is contained in:
parent
ad71f8cf9f
commit
05a87b9664
1 changed files with 15 additions and 0 deletions
|
|
@ -70,6 +70,21 @@ func TestGenMdNoHiddenParents(t *testing.T) {
|
|||
checkStringOmits(t, output, "Options inherited from parent commands")
|
||||
}
|
||||
|
||||
func TestGenMdJSONFields(t *testing.T) {
|
||||
buf := new(bytes.Buffer)
|
||||
if err := genMarkdownCustom(jsonCmd, buf, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := buf.String()
|
||||
|
||||
checkStringContains(t, output, jsonCmd.Long)
|
||||
checkStringContains(t, output, jsonCmd.Example)
|
||||
checkStringContains(t, output, "JSON Fields")
|
||||
checkStringContains(t, output, "`foo`")
|
||||
checkStringContains(t, output, "`bar`")
|
||||
checkStringContains(t, output, "`baz`")
|
||||
}
|
||||
|
||||
func TestGenMdTree(t *testing.T) {
|
||||
c := &cobra.Command{Use: "do [OPTIONS] arg1 arg2"}
|
||||
tmpdir, err := os.MkdirTemp("", "test-gen-md-tree")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue