From ef74c77d5a6bc8abf43a7a4434b2e7b61d3c0c78 Mon Sep 17 00:00:00 2001 From: cpanato Date: Mon, 4 Mar 2024 06:01:27 -0500 Subject: [PATCH] update test to use testify Signed-off-by: cpanato --- go.mod | 2 ++ go.sum | 3 ++- pkg/version/version_test.go | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 864bcc8b..23f1cd49 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/sigstore/sigstore v1.8.2 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 + github.com/stretchr/testify v1.9.0 golang.org/x/crypto v0.20.0 golang.org/x/oauth2 v0.17.0 golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 @@ -161,6 +162,7 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect diff --git a/go.sum b/go.sum index fe74a49f..b81d9f12 100644 --- a/go.sum +++ b/go.sum @@ -614,8 +614,9 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= diff --git a/pkg/version/version_test.go b/pkg/version/version_test.go index 1920f3c2..69a063ec 100644 --- a/pkg/version/version_test.go +++ b/pkg/version/version_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" ) func TestVersionText(t *testing.T) { @@ -45,7 +45,5 @@ func TestEnv(t *testing.T) { want = append(want, fmt.Sprintf("GITSIGN_LOG=%s", os.Getenv("GITSIGN_LOG"))) } - if diff := cmp.Diff(got.Env, want); diff != "" { - t.Error(diff) - } + require.Equal(t, want, got.Env) }