1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
goreleaser/pipeline/defaults/remote_test.go
Carlos Alexandro Becker 529af6fe72 refactor: improved git error handling
Improved the error handling in git code,
mostly in the defaults pipe. The idea is to
output better error messages, hopefully avoiding
confusion on "whats wrong".

refs #356
2017-10-15 19:18:04 -02:00

30 lines
776 B
Go

package defaults
import (
"testing"
"github.com/goreleaser/goreleaser/internal/testlib"
"github.com/stretchr/testify/assert"
)
func TestRepoName(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:goreleaser/goreleaser.git")
repo, err := remoteRepo()
assert.NoError(t, err)
assert.Equal(t, "goreleaser/goreleaser", repo.String())
}
func TestExtractReporFromGitURL(t *testing.T) {
repo := extractRepoFromURL("git@github.com:goreleaser/goreleaser.git")
assert.Equal(t, "goreleaser/goreleaser", repo.String())
}
func TestExtractReporFromHttpsURL(t *testing.T) {
repo := extractRepoFromURL("https://github.com/goreleaser/goreleaser.git")
assert.Equal(t, "goreleaser/goreleaser", repo.String())
}