(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestNewCmdFork(t *testing.T) { |
| 28 | tests := []struct { |
| 29 | name string |
| 30 | cli string |
| 31 | tty bool |
| 32 | wants ForkOptions |
| 33 | wantErr bool |
| 34 | errMsg string |
| 35 | }{ |
| 36 | { |
| 37 | name: "repo with git args", |
| 38 | cli: "foo/bar -- --foo=bar", |
| 39 | wants: ForkOptions{ |
| 40 | Repository: "foo/bar", |
| 41 | GitArgs: []string{"--foo=bar"}, |
| 42 | RemoteName: "origin", |
| 43 | Rename: true, |
| 44 | }, |
| 45 | }, |
| 46 | { |
| 47 | name: "git args without repo", |
| 48 | cli: "-- --foo bar", |
| 49 | wantErr: true, |
| 50 | errMsg: "repository argument required when passing git clone flags", |
| 51 | }, |
| 52 | { |
| 53 | name: "repo", |
| 54 | cli: "foo/bar", |
| 55 | wants: ForkOptions{ |
| 56 | Repository: "foo/bar", |
| 57 | RemoteName: "origin", |
| 58 | Rename: true, |
| 59 | GitArgs: []string{}, |
| 60 | }, |
| 61 | }, |
| 62 | { |
| 63 | name: "blank remote name", |
| 64 | cli: "--remote --remote-name=''", |
| 65 | wantErr: true, |
| 66 | errMsg: "--remote-name cannot be blank", |
| 67 | }, |
| 68 | { |
| 69 | name: "remote name", |
| 70 | cli: "--remote --remote-name=foo", |
| 71 | wants: ForkOptions{ |
| 72 | RemoteName: "foo", |
| 73 | Rename: false, |
| 74 | Remote: true, |
| 75 | }, |
| 76 | }, |
| 77 | { |
| 78 | name: "blank nontty", |
| 79 | cli: "", |
| 80 | wants: ForkOptions{ |
| 81 | RemoteName: "origin", |
| 82 | Rename: true, |
| 83 | Organization: "", |
| 84 | }, |
nothing calls this directly
no test coverage detected