mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
more tests
This commit is contained in:
parent
a25f6c37d5
commit
522048c62f
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user