Skip to content

Commit

Permalink
add test for list "vcs" option
Browse files Browse the repository at this point in the history
  • Loading branch information
msh5 committed May 5, 2019
1 parent 689cb82 commit 738de52
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,17 @@ func TestCommandListUnknown(t *testing.T) {
}

func TestDoList_query(t *testing.T) {
repos := []string{
gitRepos := []string{
"github.com/motemen/ghq",
"github.com/motemen/gobump",
"github.com/motemen/gore",
"github.com/Songmu/gobump",
"golang.org/x/crypt",
"golang.org/x/image",
}
svnRepos := []string{
"github.com/msh5/svntest",
}
testCases := []struct {
name string
args []string
Expand Down Expand Up @@ -102,12 +105,19 @@ func TestDoList_query(t *testing.T) {
name: "exact query",
args: []string{"-e", "men/go"},
expect: "",
}, {
name: "vcs",
args: []string{"--vcs", "svn"},
expect: "github.com/msh5/svntest\n",
}}

withFakeGitBackend(t, func(t *testing.T, tmproot string, _ *_cloneArgs, _ *_updateArgs) {
for _, r := range repos {
for _, r := range gitRepos {
os.MkdirAll(filepath.Join(tmproot, r, ".git"), 0755)
}
for _, r := range svnRepos {
os.MkdirAll(filepath.Join(tmproot, r, ".svn"), 0755)
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
args := append([]string{"ghq", "list"}, tc.args...)
Expand Down

0 comments on commit 738de52

Please sign in to comment.