(t *testing.T)
| 125 | } |
| 126 | |
| 127 | func TestGenManSeeAlso(t *testing.T) { |
| 128 | rootCmd := &cobra.Command{Use: "root", Run: emptyRun} |
| 129 | aCmd := &cobra.Command{Use: "aaa", Run: emptyRun, Hidden: true} // #229 |
| 130 | bCmd := &cobra.Command{Use: "bbb", Run: emptyRun} |
| 131 | cCmd := &cobra.Command{Use: "ccc", Run: emptyRun} |
| 132 | rootCmd.AddCommand(aCmd, bCmd, cCmd) |
| 133 | |
| 134 | buf := new(bytes.Buffer) |
| 135 | header := &GenManHeader{} |
| 136 | if err := GenMan(rootCmd, header, buf); err != nil { |
| 137 | t.Fatal(err) |
| 138 | } |
| 139 | scanner := bufio.NewScanner(buf) |
| 140 | |
| 141 | if err := assertLineFound(scanner, ".SH SEE ALSO"); err != nil { |
| 142 | t.Fatalf("Couldn't find SEE ALSO section header: %v", err) |
| 143 | } |
| 144 | if err := assertNextLineEquals(scanner, `\fBroot-bbb(1)\fP, \fBroot-ccc(1)\fP`); err != nil { |
| 145 | t.Fatalf("Second line after SEE ALSO wasn't correct: %v", err) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func TestManPrintFlagsHidesShortDeprecated(t *testing.T) { |
| 150 | c := &cobra.Command{} |
nothing calls this directly
no test coverage detected