MCPcopy
hub / github.com/cli/cli / Test_RepoClone

Function Test_RepoClone

pkg/cmd/repo/clone/clone_test.go:152–245  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func Test_RepoClone(t *testing.T) {
153 tests := []struct {
154 name string
155 args string
156 want string
157 }{
158 {
159 name: "shorthand",
160 args: "OWNER/REPO",
161 want: "git clone https://github.com/OWNER/REPO.git",
162 },
163 {
164 name: "shorthand with directory",
165 args: "OWNER/REPO target_directory",
166 want: "git clone https://github.com/OWNER/REPO.git target_directory",
167 },
168 {
169 name: "clone arguments",
170 args: "OWNER/REPO -- -o upstream --depth 1",
171 want: "git clone -o upstream --depth 1 https://github.com/OWNER/REPO.git",
172 },
173 {
174 name: "clone arguments with directory",
175 args: "OWNER/REPO target_directory -- -o upstream --depth 1",
176 want: "git clone -o upstream --depth 1 https://github.com/OWNER/REPO.git target_directory",
177 },
178 {
179 name: "HTTPS URL",
180 args: "https://github.com/OWNER/REPO",
181 want: "git clone https://github.com/OWNER/REPO.git",
182 },
183 {
184 name: "HTTPS URL with extra path parts",
185 args: "https://github.com/OWNER/REPO/extra/part?key=value#fragment",
186 want: "git clone https://github.com/OWNER/REPO.git",
187 },
188 {
189 name: "SSH URL",
190 args: "git@github.com:OWNER/REPO.git",
191 want: "git clone git@github.com:OWNER/REPO.git",
192 },
193 {
194 name: "Non-canonical capitalization",
195 args: "Owner/Repo",
196 want: "git clone https://github.com/OWNER/REPO.git",
197 },
198 {
199 name: "clone wiki",
200 args: "Owner/Repo.wiki",
201 want: "git clone https://github.com/OWNER/REPO.wiki.git",
202 },
203 {
204 name: "wiki URL",
205 args: "https://github.com/owner/repo.wiki",
206 want: "git clone https://github.com/OWNER/REPO.wiki.git",
207 },
208 {
209 name: "wiki URL with extra path parts",

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
StubFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
runCloneCommandFunction · 0.70
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected