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

36 lines
738 B
Go
Raw Normal View History

2018-09-12 19:18:01 +02:00
package pipe
2017-08-20 21:35:46 +02:00
import (
2017-09-12 05:22:02 +02:00
"errors"
2017-08-20 21:35:46 +02:00
"testing"
"github.com/stretchr/testify/require"
2017-08-20 21:35:46 +02:00
)
func TestSkipPipe(t *testing.T) {
reason := "this is a test"
err := Skip(reason)
require.Error(t, err)
require.Equal(t, reason, err.Error())
2017-08-20 21:35:46 +02:00
}
2017-09-12 05:22:02 +02:00
func TestIsSkip(t *testing.T) {
require.True(t, IsSkip(Skip("whatever")))
require.False(t, IsSkip(errors.New("nope")))
2017-09-12 05:22:02 +02:00
}
func TestSkipMemento(t *testing.T) {
m := SkipMemento{}
m.Remember(Skip("foo"))
m.Remember(Skip("bar"))
// test duplicated errors
m.Remember(Skip("dupe"))
m.Remember(Skip("dupe"))
require.EqualError(t, m.Evaluate(), `foo, bar, dupe`)
require.True(t, IsSkip(m.Evaluate()))
}
func TestSkipMementoNoErrors(t *testing.T) {
require.NoError(t, (&SkipMemento{}).Evaluate())
}