(t *testing.T)
| 259 | } |
| 260 | |
| 261 | func TestBashCompletionTraverseChildren(t *testing.T) { |
| 262 | c := &Command{Use: "c", Run: emptyRun, TraverseChildren: true} |
| 263 | |
| 264 | c.Flags().StringP("string-flag", "s", "", "string flag") |
| 265 | c.Flags().BoolP("bool-flag", "b", false, "bool flag") |
| 266 | |
| 267 | buf := new(bytes.Buffer) |
| 268 | assertNoErr(t, c.GenBashCompletion(buf)) |
| 269 | output := buf.String() |
| 270 | |
| 271 | // check that local nonpersistent flag are not set since we have TraverseChildren set to true |
| 272 | checkOmit(t, output, `local_nonpersistent_flags+=("--string-flag")`) |
| 273 | checkOmit(t, output, `local_nonpersistent_flags+=("--string-flag=")`) |
| 274 | checkOmit(t, output, `local_nonpersistent_flags+=("-s")`) |
| 275 | checkOmit(t, output, `local_nonpersistent_flags+=("--bool-flag")`) |
| 276 | checkOmit(t, output, `local_nonpersistent_flags+=("-b")`) |
| 277 | } |
| 278 | |
| 279 | func TestBashCompletionNoActiveHelp(t *testing.T) { |
| 280 | c := &Command{Use: "c", Run: emptyRun} |
nothing calls this directly
no test coverage detected