diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2020-03-30 20:40:25 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2020-03-30 20:40:25 +0200 |
| commit | 0361bc3af31a06ec64adeab0ca2d1534a1c35ed0 (patch) | |
| tree | ca25c6aa4f7052617664b456096e0d42acd5eef2 /internal/rtree/remote_test.go | |
| parent | fdffeee7dc2a4869c85f0c298e3d12924846724b (diff) | |
| download | gofu-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/remote_test.go')
| -rw-r--r-- | internal/rtree/remote_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/rtree/remote_test.go b/internal/rtree/remote_test.go index 3841c5b..5910a5c 100644 --- a/internal/rtree/remote_test.go +++ b/internal/rtree/remote_test.go @@ -28,7 +28,7 @@ var remoteAliasesForExpansionTest = []*RemoteAlias{ {Alias: "test:", Replacement: "test:test:"}, } -var testExpansions = map[string]string{ +var testExpansions = map[string]RemoteURL{ "gh:foo/bar": "https://github.com/foo/bar", "gh:f:bar": "https://github.com/foo/bar", "gh:b:foo": "https://github.com/bar/foo", @@ -37,10 +37,10 @@ var testExpansions = map[string]string{ "https://github.com/foo/bar": "https://github.com/foo/bar", //no expansion at all } -func TestExpandRemoteURL(t *testing.T) { +func TestParseRemoteURL(t *testing.T) { RemoteAliases = remoteAliasesForExpansionTest for input, expected := range testExpansions { - actual := ExpandRemoteURL(input) + actual := ParseRemoteURL(input) if actual != expected { t.Errorf("expected %q to expand into %q, but got %q", input, expected, actual) } @@ -48,7 +48,7 @@ func TestExpandRemoteURL(t *testing.T) { } //Most of those are just reversed from `testExpansions`. -var testContractions = map[string]string{ +var testContractions = map[RemoteURL]string{ "https://github.com/foo/bar": "gh:f:bar", "https://github.com/bar/foo": "gh:b:foo", "https://github.com/qux/foobar": "gh:qux/foobar", @@ -57,10 +57,10 @@ var testContractions = map[string]string{ "git://somewhereelse.com/foo/bar": "git://somewhereelse.com/foo/bar", } -func TestContractRemoteURL(t *testing.T) { +func TestCompactRemoteURL(t *testing.T) { RemoteAliases = remoteAliasesForExpansionTest for input, expected := range testContractions { - actual := ContractRemoteURL(input) + actual := input.CompactURL() if actual != expected { t.Errorf("expected %q to contract into %q, but got %q", input, expected, actual) } |
