2017-12-02 19:53:19 -02:00
|
|
|
package release
|
2017-01-14 19:12:20 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2017-10-15 17:46:21 -02:00
|
|
|
"github.com/goreleaser/goreleaser/internal/testlib"
|
2017-01-14 19:12:20 +01:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestRepoName(t *testing.T) {
|
2017-10-15 17:46:21 -02:00
|
|
|
_, back := testlib.Mktmp(t)
|
|
|
|
defer back()
|
|
|
|
testlib.GitInit(t)
|
|
|
|
testlib.GitRemoteAdd(t, "git@github.com:goreleaser/goreleaser.git")
|
2017-03-22 21:01:29 -03:00
|
|
|
repo, err := remoteRepo()
|
2017-09-26 19:24:49 -03:00
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.Equal(t, "goreleaser/goreleaser", repo.String())
|
2017-01-14 19:12:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestExtractReporFromGitURL(t *testing.T) {
|
2017-03-22 21:01:29 -03:00
|
|
|
repo := extractRepoFromURL("git@github.com:goreleaser/goreleaser.git")
|
2017-09-26 19:24:49 -03:00
|
|
|
assert.Equal(t, "goreleaser/goreleaser", repo.String())
|
2017-01-14 19:12:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestExtractReporFromHttpsURL(t *testing.T) {
|
2017-03-22 21:01:29 -03:00
|
|
|
repo := extractRepoFromURL("https://github.com/goreleaser/goreleaser.git")
|
2017-09-26 19:24:49 -03:00
|
|
|
assert.Equal(t, "goreleaser/goreleaser", repo.String())
|
2017-01-14 19:12:20 +01:00
|
|
|
}
|