package api
import "testing"
func TestAMirrorRemoteBecomesItsWebAddress(t *testing.T) {
for remote, want := range map[string]string{
"[email protected]:owner/repo.git": "github.com owner/repo",
"ssh://[email protected]/owner/repo.git": "github.com owner/repo",
"ssh://[email protected]:2222/g/sub/r": "host.example g/sub/r",
"[email protected]:group/sub/repo": "gitlab.example.org group/sub/repo",
"ssh://[email protected]:2222/~/repo.git": " ",
} {
h, p := gitRemoteHostPath(remote)
if got := h + " " + p; got != want {
t.Errorf("FAIL: %q -> %q, want %q", remote, got, want)
}
}
}