@@ -359,8 +359,8 @@ func TestUsageIncludesTopLevelCommandIndex(t *testing.T) {
359359 for _ , want := range []string {
360360 "Available Commands:" ,
361361 "agent Manage agents" ,
362- "room Manage rooms" ,
363- "user Manage users" ,
362+ "room Manage IM rooms" ,
363+ "user Manage IM users" ,
364364 } {
365365 if ! strings .Contains (got , want ) {
366366 t .Fatalf ("usage = %q, want substring %q" , got , want )
@@ -385,8 +385,8 @@ func TestRootHelpIncludesAvailableCommands(t *testing.T) {
385385 for _ , want := range []string {
386386 "Available Commands:" ,
387387 "agent Manage agents" ,
388- "room Manage rooms" ,
389- "user Manage users" ,
388+ "room Manage IM rooms" ,
389+ "user Manage IM users" ,
390390 } {
391391 if ! strings .Contains (got , want ) {
392392 t .Fatalf ("help = %q, want substring %q" , got , want )
@@ -488,29 +488,23 @@ func TestAgentSubcommandHelpIncludesUsageAndFlags(t *testing.T) {
488488 }
489489}
490490
491- func TestExecuteStartRemainsServeAlias (t * testing.T ) {
492- called := false
491+ func TestExecuteStartIsRejected (t * testing.T ) {
492+ var stderr bytes. Buffer
493493 app := & App {
494494 stdout : & bytes.Buffer {},
495- stderr : & bytes. Buffer {} ,
495+ stderr : & stderr ,
496496 httpClient : roundTripFunc (func (req * http.Request ) (* http.Response , error ) { return nil , nil }),
497- serveFunc : func (_ context.Context , args []string , globals GlobalOptions ) error {
498- called = true
499- if len (args ) != 0 {
500- t .Fatalf ("args = %v, want empty" , args )
501- }
502- if globals .Config != "/tmp/test.toml" {
503- t .Fatalf ("globals.Config = %q, want /tmp/test.toml" , globals .Config )
504- }
505- return nil
506- },
507497 }
508498
509- if err := app .Execute (context .Background (), []string {"--config" , "/tmp/test.toml" , "start" }); err != nil {
510- t .Fatalf ("Execute() error = %v" , err )
499+ err := app .Execute (context .Background (), []string {"--config" , "/tmp/test.toml" , "start" })
500+ if err == nil {
501+ t .Fatal ("Execute() error = nil, want unknown command" )
502+ }
503+ if ! strings .Contains (err .Error (), `unknown command "start"` ) {
504+ t .Fatalf ("Execute() error = %v, want unknown command start" , err )
511505 }
512- if ! called {
513- t .Fatal ( "serveFunc was not called for start alias" )
506+ if ! strings . Contains ( stderr . String (), " serve Start the local HTTP server" ) {
507+ t .Fatalf ( "stderr = %q, want serve command in usage" , stderr . String () )
514508 }
515509}
516510
0 commit comments