MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestUpdateCmd_Completion

Function TestUpdateCmd_Completion

cmds/cmd_update_test.go:159–252  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

157}
158
159func TestUpdateCmd_Completion(t *testing.T) {
160 // Cleanup.
161 dirs.RemoveAllForTest()
162
163 // Check error.
164 var check = func(err error) {
165 t.Helper()
166 if err != nil {
167 t.Fatal(err)
168 }
169 }
170
171 // Init celer.
172 celer := configs.NewCeler()
173 check(celer.Init())
174
175 updateCmd := updateCmd{celer: celer}
176 cmd := updateCmd.Command(celer)
177
178 tests := []struct {
179 name string
180 toComplete string
181 expected []string
182 }{
183 {
184 name: "complete_conf_repo_flag",
185 toComplete: "--conf",
186 expected: []string{"--conf-repo"},
187 },
188 {
189 name: "complete_conf_repo_short_flag",
190 toComplete: "-c",
191 expected: []string{"-c"},
192 },
193 {
194 name: "complete_ports_repo_flag",
195 toComplete: "--ports",
196 expected: []string{"--ports-repo"},
197 },
198 {
199 name: "complete_force_flag",
200 toComplete: "--f",
201 expected: []string{"--force"},
202 },
203 {
204 name: "complete_recursive_flag",
205 toComplete: "--r",
206 expected: []string{"--recursive"},
207 },
208 {
209 name: "no_completion_for_random",
210 toComplete: "--random",
211 expected: []string{},
212 },
213 }
214
215 for _, test := range tests {
216 t.Run(test.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 8

InitMethod · 0.95
CommandMethod · 0.95
completionMethod · 0.95
RemoveAllForTestFunction · 0.92
NewCelerFunction · 0.92
checkFunction · 0.85
MkdirAllMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected