(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestNewCmdCopilot(t *testing.T) { |
| 31 | tests := []struct { |
| 32 | name string |
| 33 | args string |
| 34 | wantOpts CopilotOptions |
| 35 | wantErrString string |
| 36 | wantHelp bool |
| 37 | }{ |
| 38 | { |
| 39 | name: "no argument", |
| 40 | args: "", |
| 41 | wantOpts: CopilotOptions{ |
| 42 | CopilotArgs: []string{}, |
| 43 | }, |
| 44 | wantErrString: "", |
| 45 | }, |
| 46 | { |
| 47 | name: "with arguments", |
| 48 | args: "some-arg some-other-arg", |
| 49 | wantOpts: CopilotOptions{ |
| 50 | CopilotArgs: []string{"some-arg", "some-other-arg"}, |
| 51 | }, |
| 52 | }, |
| 53 | { |
| 54 | name: "with --remove alone", |
| 55 | args: "--remove", |
| 56 | wantOpts: CopilotOptions{ |
| 57 | Remove: true, |
| 58 | }, |
| 59 | }, |
| 60 | { |
| 61 | name: "with non-gh flags passed to copilot", |
| 62 | args: "-p testing --something-flag", |
| 63 | wantOpts: CopilotOptions{ |
| 64 | CopilotArgs: []string{"-p", "testing", "--something-flag"}, |
| 65 | }, |
| 66 | }, |
| 67 | { |
| 68 | name: "with --remove and arguments", |
| 69 | args: "--remove some-arg", |
| 70 | wantErrString: "cannot use --remove with args", |
| 71 | }, |
| 72 | { |
| 73 | name: "with --remove passed to copilot using --", |
| 74 | args: "-- --remove", |
| 75 | wantOpts: CopilotOptions{ |
| 76 | CopilotArgs: []string{"--remove"}, |
| 77 | }, |
| 78 | }, |
| 79 | { |
| 80 | name: "with --remove and -- alone", |
| 81 | args: "--remove --", |
| 82 | wantOpts: CopilotOptions{ |
| 83 | Remove: true, |
| 84 | }, |
| 85 | }, |
| 86 | { |
| 87 | name: "with --remove, some invalid arg, and --", |
nothing calls this directly
no test coverage detected