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