mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
Adding another test case and running go fmt
This commit is contained in:
parent
53df3e1140
commit
4ddb67df3c
24
cmd_list.go
24
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue