mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-06 03:13:48 +02:00
92f52ac406
* refactor: use t.Cleanup instead of defer Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * refactor: use t.Cleanup instead of defer Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * refactor: use t.Cleanup instead of defer Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * refactor: use t.Cleanup instead of defer Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * fix: filepath Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
35 lines
997 B
Go
35 lines
997 B
Go
package git_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/internal/git"
|
|
"github.com/goreleaser/goreleaser/internal/testlib"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestRepoName(t *testing.T) {
|
|
testlib.Mktmp(t)
|
|
testlib.GitInit(t)
|
|
testlib.GitRemoteAdd(t, "git@github.com:goreleaser/goreleaser.git")
|
|
repo, err := git.ExtractRepoFromConfig()
|
|
require.NoError(t, err)
|
|
require.Equal(t, "goreleaser/goreleaser", repo.String())
|
|
}
|
|
|
|
func TestExtractRepoFromURL(t *testing.T) {
|
|
for _, url := range []string{
|
|
"git@github.com:goreleaser/goreleaser.git",
|
|
"git@custom:goreleaser/goreleaser.git",
|
|
"git@custom:crazy/url/goreleaser/goreleaser.git",
|
|
"https://github.com/goreleaser/goreleaser.git",
|
|
"https://github.enterprise.com/goreleaser/goreleaser.git",
|
|
"https://github.enterprise.com/crazy/url/goreleaser/goreleaser.git",
|
|
} {
|
|
t.Run(url, func(t *testing.T) {
|
|
repo := git.ExtractRepoFromURL(url)
|
|
require.Equal(t, "goreleaser/goreleaser", repo.String())
|
|
})
|
|
}
|
|
}
|