(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestGenYamlDoc(t *testing.T) { |
| 28 | // We generate on s subcommand so we have both subcommands and parents |
| 29 | buf := new(bytes.Buffer) |
| 30 | if err := GenYaml(echoCmd, buf); err != nil { |
| 31 | t.Fatal(err) |
| 32 | } |
| 33 | output := buf.String() |
| 34 | |
| 35 | checkStringContains(t, output, echoCmd.Long) |
| 36 | checkStringContains(t, output, echoCmd.Example) |
| 37 | checkStringContains(t, output, "boolone") |
| 38 | checkStringContains(t, output, "rootflag") |
| 39 | checkStringContains(t, output, rootCmd.Short) |
| 40 | checkStringContains(t, output, echoSubCmd.Short) |
| 41 | checkStringContains(t, output, fmt.Sprintf("- %s - %s", echoSubCmd.CommandPath(), echoSubCmd.Short)) |
| 42 | } |
| 43 | |
| 44 | func TestGenYamlNoTag(t *testing.T) { |
| 45 | rootCmd.DisableAutoGenTag = true |
nothing calls this directly
no test coverage detected