mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
1ed299a6d7
Right now the code looks weird because the defaults of a pipe are far away of the implementation of the pipe. the intend of this PR is to bring them closer by having a Defaulter interface. I also renamed the Pipe interface to Piper, and removed the Description method in favor for fmt.Stringer.
30 lines
775 B
Go
30 lines
775 B
Go
package release
|
|
|
|
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())
|
|
}
|