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