github.1git.de/goreleaser/goreleaser@v0.92.0/internal/pipe/release/remote_test.go (about) 1 package release 2 3 import ( 4 "testing" 5 6 "github.com/goreleaser/goreleaser/internal/testlib" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestRepoName(t *testing.T) { 11 _, back := testlib.Mktmp(t) 12 defer back() 13 testlib.GitInit(t) 14 testlib.GitRemoteAdd(t, "git@github.com:goreleaser/goreleaser.git") 15 repo, err := remoteRepo() 16 assert.NoError(t, err) 17 assert.Equal(t, "goreleaser/goreleaser", repo.String()) 18 } 19 20 func TestExtractRepoFromURL(t *testing.T) { 21 for _, url := range []string{ 22 "git@github.com:goreleaser/goreleaser.git", 23 "git@custom:goreleaser/goreleaser.git", 24 "git@custom:crazy/url/goreleaser/goreleaser.git", 25 "https://github.com/goreleaser/goreleaser.git", 26 "https://github.enterprise.com/goreleaser/goreleaser.git", 27 "https://github.enterprise.com/crazy/url/goreleaser/goreleaser.git", 28 } { 29 t.Run(url, func(t *testing.T) { 30 repo := extractRepoFromURL(url) 31 assert.Equal(t, "goreleaser/goreleaser", repo.String()) 32 }) 33 } 34 }