MCPcopy Create free account
hub / github.com/docker/docker-agent / TestCompleteRunExec

Function TestCompleteRunExec

cmd/root/completion_test.go:286–322  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestCompleteRunExec(t *testing.T) {
287 t.Parallel()
288
289 tests := []struct {
290 name string
291 args []string
292 toComplete string
293 wantNoFileComp bool
294 }{
295 {
296 name: "first arg completes agent file",
297 args: []string{},
298 toComplete: "./",
299 wantNoFileComp: true,
300 },
301 {
302 name: "third arg and beyond returns no completions",
303 args: []string{"agent.yaml", "message"},
304 toComplete: "anything",
305 wantNoFileComp: true,
306 },
307 }
308
309 for _, tt := range tests {
310 t.Run(tt.name, func(t *testing.T) {
311 t.Parallel()
312
313 cmd := &cobra.Command{}
314 _, directive := completeRunExec(cmd, tt.args, tt.toComplete)
315
316 if tt.wantNoFileComp {
317 assert.NotEqual(t, cobra.ShellCompDirective(0), directive&cobra.ShellCompDirectiveNoFileComp,
318 "expected NoFileComp directive to be set")
319 }
320 })
321 }
322}
323
324func TestCompleteTheme(t *testing.T) {
325 t.Parallel()

Callers

nothing calls this directly

Calls 2

completeRunExecFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected