aboutsummaryrefslogtreecommitdiff
path: root/internal/rtree/get_test.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2020-03-30 20:40:25 +0200
committerStefan Majewsky <majewsky@gmx.net>2020-03-30 20:40:25 +0200
commit0361bc3af31a06ec64adeab0ca2d1534a1c35ed0 (patch)
treeca25c6aa4f7052617664b456096e0d42acd5eef2 /internal/rtree/get_test.go
parentfdffeee7dc2a4869c85f0c298e3d12924846724b (diff)
downloadgofu-0361bc3af31a06ec64adeab0ca2d1534a1c35ed0.tar.gz
rtree: always store compact remote URLs in the index file
Includes a refactor to use a type RemoteURL with a more natural API.
Diffstat (limited to 'internal/rtree/get_test.go')
-rw-r--r--internal/rtree/get_test.go33
1 files changed, 18 insertions, 15 deletions
diff --git a/internal/rtree/get_test.go b/internal/rtree/get_test.go
index bdd0f2e..a438234 100644
--- a/internal/rtree/get_test.go
+++ b/internal/rtree/get_test.go
@@ -60,24 +60,27 @@ func TestGetExistingRepoWithoutShortcut(t *testing.T) {
func TestGetNewRepo(t *testing.T) {
target := filepath.Join(RootPath, "/github.com/another/repo")
- Test{
- Args: []string{"get", "gh:another/repo"},
- Index: testIndexWithTwoRepos,
- ExpectOutput: target + "\n",
- ExpectExecution: Recorded("git clone gh:another/repo " + target),
- ExpectIndex: &Index{
- Repos: []*Repo{
- {
- CheckoutPath: "github.com/another/repo",
- Remotes: []Remote{
- {Name: "origin", URL: "gh:another/repo"},
+ for _, remoteURL := range []string{"gh:another/repo", "https://github.com/another/repo"} {
+ Test{
+ Args: []string{"get", remoteURL},
+ Index: testIndexWithTwoRepos,
+ ExpectOutput: target + "\n",
+ ExpectExecution: Recorded("git clone gh:another/repo " + target),
+ ExpectIndex: &Index{
+ Repos: []*Repo{
+ {
+ CheckoutPath: "github.com/another/repo",
+ Remotes: []Remote{
+ //regardless of the remote URL used, we expect the contracted form to be used
+ {Name: "origin", URL: "gh:another/repo"},
+ },
},
+ testIndexWithTwoRepos.Repos[0],
+ testIndexWithTwoRepos.Repos[1],
},
- testIndexWithTwoRepos.Repos[0],
- testIndexWithTwoRepos.Repos[1],
},
- },
- }.Run(t)
+ }.Run(t)
+ }
}
func TestGetNewForkAsRemote(t *testing.T) {