1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/git/config_test.go
Brian Flad 01fd3e8c7b
feat: support closing milestones (#1657)
* feat: support closing milestones

Reference: https://github.com/goreleaser/goreleaser/issues/1415

* refactor: Adjust milestone handling for code simplification, add ErrNoMilestoneFound, and fix milestone documentation close default

Reference: https://github.com/goreleaser/goreleaser/pull/1657#pullrequestreview-445025743

* refactor: Use single repo config in milestones instead of each VCS

* fix: Ensure milestone Pipe is included in Defaulters

* feat: Add fail_on_error configuration to milestone configuration

Co-authored-by: Radek Simko <radek.simko@gmail.com>
2020-07-09 21:40:37 +01:00

36 lines
1018 B
Go

package git_test
import (
"testing"
"github.com/goreleaser/goreleaser/internal/git"
"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 := git.ExtractRepoFromConfig()
assert.NoError(t, err)
assert.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)
assert.Equal(t, "goreleaser/goreleaser", repo.String())
})
}
}