github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/project/project_test.go (about) 1 package project 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 8 "github.com/goreleaser/goreleaser/pkg/config" 9 "github.com/goreleaser/goreleaser/pkg/context" 10 ) 11 12 func TestCustomProjectName(t *testing.T) { 13 var ctx = context.New(config.Project{ 14 ProjectName: "foo", 15 Release: config.Release{ 16 GitHub: config.Repo{ 17 Owner: "bar", 18 Name: "bar", 19 }, 20 }, 21 }) 22 require.NoError(t, Pipe{}.Default(ctx)) 23 require.Equal(t, "foo", ctx.Config.ProjectName) 24 } 25 26 func TestEmptyProjectName(t *testing.T) { 27 var ctx = context.New(config.Project{ 28 Release: config.Release{ 29 GitHub: config.Repo{ 30 Owner: "bar", 31 Name: "bar", 32 }, 33 }, 34 }) 35 require.NoError(t, Pipe{}.Default(ctx)) 36 require.Equal(t, "bar", ctx.Config.ProjectName) 37 }