(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestPluginStubCompletionRestoresOSArgs(t *testing.T) { |
| 41 | cmd, err := preparePluginStubCommand(t) |
| 42 | assert.NilError(t, err) |
| 43 | |
| 44 | savedArgs := os.Args |
| 45 | t.Cleanup(func() { os.Args = savedArgs }) |
| 46 | |
| 47 | originalArgs := []string{"docker", "image", "ls"} |
| 48 | os.Args = append([]string(nil), originalArgs...) |
| 49 | |
| 50 | _, directive := cmd.ValidArgsFunction(cmd, []string{"--all"}, "alp") |
| 51 | assert.Equal(t, directive, cobra.ShellCompDirectiveError) |
| 52 | assert.DeepEqual(t, os.Args, originalArgs) |
| 53 | } |
| 54 | |
| 55 | func preparePluginStubCommand(t *testing.T) (*cobra.Command, error) { |
| 56 | t.Helper() |
nothing calls this directly
no test coverage detected
searching dependent graphs…