MCPcopy Index your code
hub / github.com/cli/cli / Test_formatRemoteURL

Function Test_formatRemoteURL

pkg/cmd/gist/clone/clone_test.go:123–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func Test_formatRemoteURL(t *testing.T) {
124 type args struct {
125 hostname string
126 gistID string
127 protocol string
128 }
129 tests := []struct {
130 name string
131 args args
132 want string
133 }{
134 {
135 name: "github.com HTTPS",
136 args: args{
137 hostname: "github.com",
138 protocol: "https",
139 gistID: "ID",
140 },
141 want: "https://gist.github.com/ID.git",
142 },
143 {
144 name: "github.com SSH",
145 args: args{
146 hostname: "github.com",
147 protocol: "ssh",
148 gistID: "ID",
149 },
150 want: "git@gist.github.com:ID.git",
151 },
152 {
153 name: "Enterprise HTTPS",
154 args: args{
155 hostname: "acme.org",
156 protocol: "https",
157 gistID: "ID",
158 },
159 want: "https://acme.org/gist/ID.git",
160 },
161 {
162 name: "Enterprise SSH",
163 args: args{
164 hostname: "acme.org",
165 protocol: "ssh",
166 gistID: "ID",
167 },
168 want: "git@acme.org:gist/ID.git",
169 },
170 }
171 for _, tt := range tests {
172 t.Run(tt.name, func(t *testing.T) {
173 if got := formatRemoteURL(tt.args.hostname, tt.args.gistID, tt.args.protocol); got != tt.want {
174 t.Errorf("formatRemoteURL() = %v, want %v", got, tt.want)
175 }
176 })
177 }
178}

Callers

nothing calls this directly

Calls 3

formatRemoteURLFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected