From 33524ebc1af630fb0a9057c35629e4b9acebfbe7 Mon Sep 17 00:00:00 2001 From: Jun Nishimura Date: Fri, 1 Sep 2023 23:53:40 +0900 Subject: [PATCH] fix unit tests --- command_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/command_test.go b/command_test.go index 540e2176..624d738a 100644 --- a/command_test.go +++ b/command_test.go @@ -1876,7 +1876,9 @@ func TestRemoveSingleGroup(t *testing.T) { rootCmd.SetHelpCommandGroupID("help") rootCmd.SetCompletionCommandGroupID("comp") - rootCmd.RemoveGroup("group") + if err := rootCmd.RemoveGroup("group"); err != nil { + t.Errorf("Unexpected error: %v", err) + } output, err := executeCommand(rootCmd, "--help") if err != nil { @@ -1895,7 +1897,9 @@ func TestRemoveHelpCommandGroup(t *testing.T) { rootCmd.AddCommand(&Command{Use: "child", Short: "c", GroupID: "group", Run: emptyRun}) rootCmd.SetHelpCommandGroupID("group") - rootCmd.RemoveGroup("group") + if err := rootCmd.RemoveGroup("group"); err != nil { + t.Errorf("Unexpected error: %v", err) + } output, err := executeCommand(rootCmd, "--help") if err != nil { @@ -1917,7 +1921,9 @@ func TestRemoveCompletionCommandGroup(t *testing.T) { rootCmd.SetHelpCommandGroupID("help") rootCmd.SetCompletionCommandGroupID("group") - rootCmd.RemoveGroup("group") + if err := rootCmd.RemoveGroup("group"); err != nil { + t.Errorf("Unexpected error: %v", err) + } output, err := executeCommand(rootCmd, "--help") if err != nil { @@ -1946,7 +1952,9 @@ func TestRemoveMultipleGroups(t *testing.T) { rootCmd.SetHelpCommandGroupID("help") rootCmd.SetCompletionCommandGroupID("comp") - rootCmd.RemoveGroup("group1", "group2") + if err := rootCmd.RemoveGroup("group1", "group2"); err != nil { + t.Errorf("Unexpected error: %v", err) + } output, err := executeCommand(rootCmd, "--help") if err != nil {