1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

more tests

This commit is contained in:
Carlos Alexandro Becker 2017-04-14 12:45:38 -03:00
parent a25f6c37d5
commit 522048c62f
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940

View File

@ -93,6 +93,33 @@ func TestRunPipeWithInvalidOS(t *testing.T) {
assert.NoError(Pipe{}.Run(ctx))
}
func TestRunPipeFailingHooks(t *testing.T) {
assert := assert.New(t)
var config = config.Project{
Build: config.Build{
Hooks: config.Hooks{},
Goos: []string{
runtime.GOOS,
},
Goarch: []string{
runtime.GOARCH,
},
},
}
var ctx = &context.Context{
Config: config,
Archives: map[string]string{},
}
t.Run("pre-hook", func(t *testing.T) {
ctx.Config.Build.Hooks.Pre = "exit 1"
assert.Error(Pipe{}.Run(ctx))
})
t.Run("post-hook", func(t *testing.T) {
ctx.Config.Build.Hooks.Post = "exit 1"
assert.Error(Pipe{}.Run(ctx))
})
}
func exists(file string) bool {
_, err := os.Stat(file)
return !os.IsNotExist(err)