(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestGenMdNoHiddenParents(t *testing.T) { |
| 49 | linkHandler := func(s string) string { return s } |
| 50 | |
| 51 | // We generate on subcommand so we have both subcommands and parents. |
| 52 | for _, name := range []string{"rootflag", "strtwo"} { |
| 53 | f := rootCmd.PersistentFlags().Lookup(name) |
| 54 | f.Hidden = true |
| 55 | defer func() { f.Hidden = false }() |
| 56 | } |
| 57 | buf := new(bytes.Buffer) |
| 58 | if err := genMarkdownCustom(echoCmd, buf, linkHandler); err != nil { |
| 59 | t.Fatal(err) |
| 60 | } |
| 61 | output := buf.String() |
| 62 | |
| 63 | checkStringContains(t, output, echoCmd.Long) |
| 64 | checkStringContains(t, output, echoCmd.Example) |
| 65 | checkStringContains(t, output, "boolone") |
| 66 | checkStringOmits(t, output, "rootflag") |
| 67 | checkStringOmits(t, output, rootCmd.Short) |
| 68 | checkStringOmits(t, output, echoSubCmd.Short) |
| 69 | checkStringOmits(t, output, deprecatedCmd.Short) |
| 70 | checkStringOmits(t, output, "Options inherited from parent commands") |
| 71 | } |
| 72 | |
| 73 | func TestGenMdAliases(t *testing.T) { |
| 74 | buf := new(bytes.Buffer) |
nothing calls this directly
no test coverage detected