MCPcopy Create free account
hub / github.com/github/gh-aw / TestCompleteEngineNames

Function TestCompleteEngineNames

pkg/cli/completions_test.go:232–274  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestCompleteEngineNames(t *testing.T) {
233 cmd := &cobra.Command{}
234
235 tests := []struct {
236 name string
237 toComplete string
238 wantLen int
239 }{
240 {
241 name: "empty prefix returns all engines",
242 toComplete: "",
243 wantLen: 8, // antigravity, copilot, claude, codex, gemini, opencode, crush, pi
244 },
245 {
246 name: "c prefix returns claude, codex, copilot, crush",
247 toComplete: "c",
248 wantLen: 4,
249 },
250 {
251 name: "co prefix returns copilot, codex",
252 toComplete: "co",
253 wantLen: 2,
254 },
255 {
256 name: "cop prefix returns copilot",
257 toComplete: "cop",
258 wantLen: 1,
259 },
260 {
261 name: "x prefix returns nothing",
262 toComplete: "x",
263 wantLen: 0,
264 },
265 }
266
267 for _, tt := range tests {
268 t.Run(tt.name, func(t *testing.T) {
269 completions, directive := CompleteEngineNames(cmd, nil, tt.toComplete)
270 assert.Len(t, completions, tt.wantLen)
271 assert.Equal(t, cobra.ShellCompDirectiveNoFileComp, directive)
272 })
273 }
274}
275
276func TestCompleteWorkflowNames(t *testing.T) {
277 // Create a temporary directory structure

Callers

nothing calls this directly

Calls 2

CompleteEngineNamesFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected