Skip to content

Commit

Permalink
chore: remove dependency to gotest.tools (#4294)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikgb authored Dec 29, 2024
1 parent 52ba937 commit 1678aad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
25 changes: 18 additions & 7 deletions pkg/sourceignore/sourceignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"testing"

"github.com/go-git/go-git/v5/plumbing/format/gitignore"
"gotest.tools/assert"
)

func TestReadPatterns(t *testing.T) {
Expand Down Expand Up @@ -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)
}
}
})
}
Expand Down Expand Up @@ -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)
}
}
})
}
Expand Down Expand Up @@ -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)
}
}
})
}
Expand Down

0 comments on commit 1678aad

Please sign in to comment.