1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/deprecate/deprecate_test.go
Carlos Alexandro Becker fe7e2123bd
feat: replacing the log library (#3139)
* feat: replacing logs

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: tests et al

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* feat: update termenv/lipgloss

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* wip: output

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: pin dep

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: update

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: tests

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: tests

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: deps

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>

* fix: dep

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2022-06-21 21:11:15 -03:00

45 lines
996 B
Go

package deprecate
import (
"bytes"
"testing"
"github.com/caarlos0/log"
"github.com/charmbracelet/lipgloss"
"github.com/goreleaser/goreleaser/internal/golden"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/muesli/termenv"
"github.com/stretchr/testify/require"
)
func TestNotice(t *testing.T) {
lipgloss.SetColorProfile(termenv.Ascii)
var w bytes.Buffer
log.Log = log.New(&w)
log.Info("first")
ctx := context.New(config.Project{})
Notice(ctx, "foo.bar.whatever: foobar")
log.Info("last")
require.True(t, ctx.Deprecated)
golden.RequireEqualTxt(t, w.Bytes())
}
func TestNoticeCustom(t *testing.T) {
lipgloss.SetColorProfile(termenv.Ascii)
var w bytes.Buffer
log.Log = log.New(&w)
log.Info("first")
ctx := context.New(config.Project{})
NoticeCustom(ctx, "something-else", "some custom template with a url {{ .URL }}")
log.Info("last")
require.True(t, ctx.Deprecated)
golden.RequireEqualTxt(t, w.Bytes())
}