1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-23 21:19:17 +02:00

47 lines
761 B
Go
Raw Normal View History

2018-03-28 15:31:09 +02:00
package before
import (
"testing"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
2018-03-28 15:31:09 +02:00
"github.com/stretchr/testify/assert"
)
func TestDescription(t *testing.T) {
assert.NotEmpty(t, Pipe{}.String())
}
func TestRunPipe(t *testing.T) {
for _, tc := range [][]string{
nil,
2018-04-03 21:37:16 -03:00
{},
{"go version"},
{"go version", "go list"},
2018-03-28 15:31:09 +02:00
} {
ctx := context.New(
config.Project{
Before: config.Before{
Hooks: tc,
},
},
)
assert.NoError(t, Pipe{}.Run(ctx))
}
}
func TestRunPipeFail(t *testing.T) {
for _, tc := range [][]string{
2018-04-03 21:37:16 -03:00
{"go tool foobar"},
2018-03-28 15:31:09 +02:00
} {
ctx := context.New(
config.Project{
Before: config.Before{
Hooks: tc,
},
},
)
assert.Error(t, Pipe{}.Run(ctx))
}
}