(t *testing.T)
| 154 | } |
| 155 | |
| 156 | func Test_RepoClone(t *testing.T) { |
| 157 | tests := []struct { |
| 158 | name string |
| 159 | args string |
| 160 | sshURL string |
| 161 | gitProtocol string |
| 162 | want string |
| 163 | }{ |
| 164 | { |
| 165 | name: "shorthand", |
| 166 | args: "OWNER/REPO", |
| 167 | want: "git clone https://github.com/OWNER/REPO.git", |
| 168 | }, |
| 169 | { |
| 170 | name: "shorthand with directory", |
| 171 | args: "OWNER/REPO target_directory", |
| 172 | want: "git clone https://github.com/OWNER/REPO.git target_directory", |
| 173 | }, |
| 174 | { |
| 175 | name: "clone arguments", |
| 176 | args: "OWNER/REPO -- -o upstream --depth 1", |
| 177 | want: "git clone -o upstream --depth 1 https://github.com/OWNER/REPO.git", |
| 178 | }, |
| 179 | { |
| 180 | name: "clone arguments with directory", |
| 181 | args: "OWNER/REPO target_directory -- -o upstream --depth 1", |
| 182 | want: "git clone -o upstream --depth 1 https://github.com/OWNER/REPO.git target_directory", |
| 183 | }, |
| 184 | { |
| 185 | name: "HTTPS URL", |
| 186 | args: "https://github.com/OWNER/REPO", |
| 187 | want: "git clone https://github.com/OWNER/REPO.git", |
| 188 | }, |
| 189 | { |
| 190 | name: "HTTPS URL with extra path parts", |
| 191 | args: "https://github.com/OWNER/REPO/extra/part?key=value#fragment", |
| 192 | want: "git clone https://github.com/OWNER/REPO.git", |
| 193 | }, |
| 194 | { |
| 195 | name: "SSH URL", |
| 196 | args: "git@github.com:OWNER/REPO.git", |
| 197 | sshURL: "git@github.com:OWNER/REPO.git", |
| 198 | want: "git clone git@github.com:OWNER/REPO.git", |
| 199 | }, |
| 200 | { |
| 201 | name: "GitHub.com SSH certificate authority URL", |
| 202 | args: "OWNER/REPO", |
| 203 | sshURL: "org-1234@github.com:OWNER/REPO.git", |
| 204 | gitProtocol: "ssh", |
| 205 | want: "git clone org-1234@github.com:OWNER/REPO.git", |
| 206 | }, |
| 207 | { |
| 208 | name: "GHE.com SSH certificate authority URL", |
| 209 | args: "test-prodweu01@test-prodweu01.ghe.com:OWNER/REPO.git", |
| 210 | sshURL: "test-prodweu01_1234@test-prodweu01.ghe.com:OWNER/REPO.git", |
| 211 | want: "git clone test-prodweu01_1234@test-prodweu01.ghe.com:OWNER/REPO.git", |
| 212 | }, |
| 213 | { |
nothing calls this directly
no test coverage detected