From 4ddb67df3cef7d0614f3e712fe6cc0eba93b8971 Mon Sep 17 00:00:00 2001 From: Brandon Mendrick Date: Wed, 21 Apr 2021 22:42:24 -0500 Subject: [PATCH] Adding another test case and running go fmt --- cmd_list.go | 24 ++++++++++++------------ cmd_list_test.go | 10 +++++++--- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/cmd_list.go b/cmd_list.go index 746efad..8dcae01 100644 --- a/cmd_list.go +++ b/cmd_list.go @@ -43,18 +43,18 @@ func doList(c *cli.Context) error { query = strings.Join(paths[1:], "/") host = paths[0] } - // Using smartcase searching - if strings.ToLower(query) == query { - filterByQuery = func(repo *LocalRepository) bool { - return strings.Contains(strings.ToLower(repo.NonHostPath()), query) && - (host == "" || repo.PathParts[0] == host) - } - } else { - filterByQuery = func(repo *LocalRepository) bool { - return strings.Contains(repo.NonHostPath(), query) && - (host == "" || repo.PathParts[0] == host) - } - } + // Using smartcase searching + if strings.ToLower(query) == query { + filterByQuery = func(repo *LocalRepository) bool { + return strings.Contains(strings.ToLower(repo.NonHostPath()), query) && + (host == "" || repo.PathParts[0] == host) + } + } else { + filterByQuery = func(repo *LocalRepository) bool { + return strings.Contains(repo.NonHostPath(), query) && + (host == "" || repo.PathParts[0] == host) + } + } } } diff --git a/cmd_list_test.go b/cmd_list_test.go index c53b634..576a38a 100644 --- a/cmd_list_test.go +++ b/cmd_list_test.go @@ -82,9 +82,9 @@ func TestDoList_query(t *testing.T) { "github.com/motemen/gobump", "github.com/motemen/gore", "github.com/Songmu/gobump", - "github.com/test/Awesome", - "github.com/test/awesome", - "github.com/test/AwEsOmE", + "github.com/test/Awesome", + "github.com/test/awesome", + "github.com/test/AwEsOmE", "golang.org/x/crypt", "golang.org/x/image", } @@ -143,6 +143,10 @@ func TestDoList_query(t *testing.T) { name: "smartcasing exact", args: []string{"Awesome"}, expect: "github.com/test/Awesome\n", + }, { + name: "smartcasing exact fail", + args: []string{"aWesome"}, + expect: "", }} withFakeGitBackend(t, func(t *testing.T, tmproot string, _ *_cloneArgs, _ *_updateArgs) {