(t *testing.T)
| 353 | } |
| 354 | |
| 355 | func TestUnique(t *testing.T) { |
| 356 | base := []string{"alpha", "beta", "gamma"} |
| 357 | |
| 358 | comp := Unique(func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { |
| 359 | return base, cobra.ShellCompDirectiveNoFileComp |
| 360 | }) |
| 361 | |
| 362 | values, directives := comp(&cobra.Command{}, []string{"beta"}, "") |
| 363 | assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp)) |
| 364 | assert.Check(t, is.DeepEqual(values, []string{"alpha", "gamma"})) |
| 365 | |
| 366 | assert.Check(t, is.DeepEqual(base, []string{"alpha", "beta", "gamma"})) |
| 367 | |
| 368 | values, directives = comp(&cobra.Command{}, []string{"gamma"}, "") |
| 369 | assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp)) |
| 370 | assert.Check(t, is.DeepEqual(values, []string{"alpha", "beta"})) |
| 371 | |
| 372 | assert.Check(t, is.DeepEqual(base, []string{"alpha", "beta", "gamma"})) |
| 373 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…