MCPcopy Create free account
hub / github.com/larksuite/cli / TestIsCompletionCommand

Function TestIsCompletionCommand

cmd/root_test.go:121–140  ·  view source on GitHub ↗

isCompletionCommand must classify BOTH cobra completion aliases as completion requests so the Shutdown emit and update-notice paths skip shell-completion invocations. __completeNoDesc is an Alias of __complete (cobra/completions.go ShellCompNoDescRequestCmd) and dispatches the same RunE; bash/zsh co

(t *testing.T)

Source from the content-addressed store, hash-verified

119// dispatches the same RunE; bash/zsh completion typically calls the
120// NoDesc variant.
121func TestIsCompletionCommand(t *testing.T) {
122 tests := []struct {
123 name string
124 args []string
125 want bool
126 }{
127 {"plain command", []string{"im", "+send"}, false},
128 {"__complete", []string{"__complete", "im"}, true},
129 {"__completeNoDesc", []string{"__completeNoDesc", "im"}, true},
130 {"completion subcommand", []string{"completion", "bash"}, true},
131 {"completion in tail", []string{"foo", "bar", "completion"}, true},
132 }
133 for _, tc := range tests {
134 t.Run(tc.name, func(t *testing.T) {
135 if got := isCompletionCommand(tc.args); got != tc.want {
136 t.Fatalf("isCompletionCommand(%v) = %v, want %v", tc.args, got, tc.want)
137 }
138 })
139 }
140}
141
142// TestHandleRootError_SecurityPolicyCanonicalEnvelope verifies that
143// *errs.SecurityPolicyError flows through the canonical typed envelope

Callers

nothing calls this directly

Calls 2

isCompletionCommandFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected