1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/internal/pipe/pipe_test.go
Carlos Alexandro Becker f61d8c820c
fix: improve output a bit (#2174)
* fix: improve output a bit

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: improve output a bit

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: revert unwanted changes

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: skip err

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: test

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* chore: build

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-04-19 09:31:57 -03:00

42 lines
912 B
Go

package pipe
import (
"errors"
"testing"
"github.com/stretchr/testify/require"
)
func TestSkipPipe(t *testing.T) {
reason := "this is a test"
err := Skip(reason)
require.Error(t, err)
require.Equal(t, reason, err.Error())
}
func TestIsSkip(t *testing.T) {
require.True(t, IsSkip(Skip("whatever")))
require.True(t, IsSkip(ErrSkipDisabledPipe))
require.False(t, IsSkip(errors.New("nope")))
}
func TestIsExpectedSkip(t *testing.T) {
require.True(t, IsSkip(ErrSkipDisabledPipe))
require.True(t, IsSkip(Skip("nope")))
}
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())
}