From 1678aad9139bb8cd58d9ea132f6550cbc501038a Mon Sep 17 00:00:00 2001 From: Erik Godding Boye Date: Sun, 29 Dec 2024 15:46:24 +0100 Subject: [PATCH] chore: remove dependency to gotest.tools (#4294) --- go.mod | 1 - go.sum | 2 -- pkg/sourceignore/sourceignore_test.go | 25 ++++++++++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index dc53240e7d..9b91b885ed 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,6 @@ require ( google.golang.org/protobuf v1.35.1 gopkg.in/go-jose/go-jose.v2 v2.6.3 gopkg.in/yaml.v3 v3.0.1 - gotest.tools v2.2.0+incompatible k8s.io/api v0.31.1 k8s.io/apiextensions-apiserver v0.31.1 k8s.io/apimachinery v0.31.1 diff --git a/go.sum b/go.sum index 92bd0451ef..7a2e07b700 100644 --- a/go.sum +++ b/go.sum @@ -976,8 +976,6 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/sourceignore/sourceignore_test.go b/pkg/sourceignore/sourceignore_test.go index 31542314a7..546d5976a3 100644 --- a/pkg/sourceignore/sourceignore_test.go +++ b/pkg/sourceignore/sourceignore_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/go-git/go-git/v5/plumbing/format/gitignore" - "gotest.tools/assert" ) func TestReadPatterns(t *testing.T) { @@ -47,10 +46,14 @@ func TestReadPatterns(t *testing.T) { ps := ReadPatterns(reader, tt.domain) matcher := NewMatcher(ps) for _, m := range tt.matches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), true, "expected %s to match", m) + if !matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to match", m) + } } for _, m := range tt.mismatches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), false, "expected %s to not match", m) + if matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to not match", m) + } } }) } @@ -133,10 +136,14 @@ func TestVCSPatterns(t *testing.T) { t.Run(tt.name, func(t *testing.T) { matcher := NewDefaultMatcher(tt.patterns, tt.domain) for _, m := range tt.matches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), true, "expected %s to match", m) + if !matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to match", m) + } } for _, m := range tt.mismatches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), false, "expected %s to not match", m) + if matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to not match", m) + } } }) } @@ -178,10 +185,14 @@ func TestDefaultPatterns(t *testing.T) { t.Run(tt.name, func(t *testing.T) { matcher := NewDefaultMatcher(tt.patterns, tt.domain) for _, m := range tt.matches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), true, "expected %s to match", m) + if !matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to match", m) + } } for _, m := range tt.mismatches { - assert.Equal(t, matcher.Match(strings.Split(m, "/"), false), false, "expected %s to not match", m) + if matcher.Match(strings.Split(m, "/"), false) { + t.Errorf("expected %s to not match", m) + } } }) }