MCPcopy Index your code
hub / github.com/larksuite/cli / TestUnknownSubcommandRunE_NoArgsShowsHelp

Function TestUnknownSubcommandRunE_NoArgsShowsHelp

cmd/unknown_subcommand_test.go:207–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

205}
206
207func TestUnknownSubcommandRunE_NoArgsShowsHelp(t *testing.T) {
208 _, drive, _ := newGroupTree()
209 installUnknownSubcommandGuard(drive.Root())
210
211 var buf bytes.Buffer
212 drive.SetOut(&buf)
213 drive.SetErr(&buf)
214
215 if err := drive.RunE(drive, nil); err != nil {
216 t.Fatalf("expected no-args invocation to succeed, got: %v", err)
217 }
218 if !strings.Contains(buf.String(), "drive ops") {
219 t.Errorf("expected help output to include the command's Short, got:\n%s", buf.String())
220 }
221}
222
223func TestUnknownSubcommandRunE_UnknownReturnsStructuredError(t *testing.T) {
224 _, drive, _ := newGroupTree()

Callers

nothing calls this directly

Calls 4

newGroupTreeFunction · 0.85
ContainsMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected