1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00

test: improving tests

Moved tests from defaults to build pipe, as it
doesnt make sense to be there.
This commit is contained in:
Carlos Alexandro Becker 2017-12-03 12:27:26 -02:00 committed by Carlos Alexandro Becker
parent 2dfdb4cd61
commit b77acd2cc7
2 changed files with 21 additions and 19 deletions

View File

@ -406,6 +406,27 @@ func TestDefaultPartialBuilds(t *testing.T) {
})
}
func TestDefaultFillSingleBuild(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
var ctx = &context.Context{
Config: config.Project{
Release: config.Release{
GitHub: config.Repo{
Name: "foo",
},
},
SingleBuild: config.Build{
Main: "testreleaser",
},
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Len(t, ctx.Config.Builds, 1)
assert.Equal(t, ctx.Config.Builds[0].Binary, "foo")
}
func exists(file string) bool {
_, err := os.Stat(file)
return !os.IsNotExist(err)

View File

@ -90,22 +90,3 @@ func TestFillPartial(t *testing.T) {
assert.Empty(t, ctx.Config.Dockers[0].Goarm)
assert.Equal(t, "disttt", ctx.Config.Dist)
}
func TestFillSingleBuild(t *testing.T) {
_, back := testlib.Mktmp(t)
defer back()
testlib.GitInit(t)
testlib.GitRemoteAdd(t, "git@github.com:goreleaser/goreleaser.git")
var ctx = &context.Context{
Config: config.Project{
SingleBuild: config.Build{
Main: "testreleaser",
},
},
}
assert.NoError(t, Pipe{}.Run(ctx))
assert.Len(t, ctx.Config.Builds, 1)
assert.Equal(t, ctx.Config.Builds[0].Binary, "goreleaser")
}