Path: blob/main/components/gitpod-cli/cmd/root_test.go
2498 views
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package cmd56import (7"testing"89"github.com/google/go-cmp/cmp"10)1112func TestGetCommandName(t *testing.T) {13tests := []struct {14Input string15Expectation []string16}{17{"gp", []string{}},18{"gp top", []string{"top"}},19{"gp tasks list", []string{"tasks", "list"}},20{"gp very nested command", []string{"very", "nested", "command"}},21}2223for _, test := range tests {24t.Run(test.Input, func(t *testing.T) {25cmdName := GetCommandName(test.Input)2627if diff := cmp.Diff(test.Expectation, cmdName); diff != "" {28t.Errorf("GetCommandName() mismatch (-want +got):\n%s", diff)29}30})31}32}333435