mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
47 lines
785 B
Go
47 lines
785 B
Go
package before
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/config"
|
|
"github.com/goreleaser/goreleaser/context"
|
|
"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,
|
|
[]string{},
|
|
[]string{"go version"},
|
|
[]string{"go version", "go list"},
|
|
} {
|
|
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{
|
|
[]string{"go tool foobar"},
|
|
} {
|
|
ctx := context.New(
|
|
config.Project{
|
|
Before: config.Before{
|
|
Hooks: tc,
|
|
},
|
|
},
|
|
)
|
|
assert.Error(t, Pipe{}.Run(ctx))
|
|
}
|
|
}
|