diff --git a/go.mod b/go.mod index 73a39f4..53f7612 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Microsoft/go-winio v0.4.15 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/go-git/go-git/v5 v5.2.0 - github.com/google/go-cmp v0.5.4 + github.com/google/go-cmp v0.5.4 // indirect github.com/imdario/mergo v0.3.11 // indirect github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect diff --git a/go.sum b/go.sum index a8f4414..ec6df4b 100644 --- a/go.sum +++ b/go.sum @@ -139,6 +139,7 @@ gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/comparision/diff.go b/pkg/comparision/diff.go deleted file mode 100644 index 5576fae..0000000 --- a/pkg/comparision/diff.go +++ /dev/null @@ -1,13 +0,0 @@ -package comparision - -import ( - "testing" - - "github.com/google/go-cmp/cmp" -) - -func Diff(t *testing.T, want, got interface{}) { - if diff := cmp.Diff(want, got); diff != "" { - t.Errorf("mismatch (-want +got):\n%s", diff) - } -} diff --git a/pkg/convention/commit_test.go b/pkg/convention/commit_test.go index 0f9ba87..c7e1a21 100644 --- a/pkg/convention/commit_test.go +++ b/pkg/convention/commit_test.go @@ -3,9 +3,9 @@ package convention import ( "testing" - "github.com/haunt98/changeloguru/pkg/comparision" "github.com/haunt98/changeloguru/pkg/git" "github.com/sebdah/goldie/v2" + "github.com/stretchr/testify/assert" ) func TestNewCommit(t *testing.T) { @@ -39,7 +39,7 @@ func TestNewCommit(t *testing.T) { g := goldie.New(t) gotResult, gotErr := NewCommit(tc.c) - comparision.Diff(t, tc.wantErr, gotErr) + assert.Equal(t, tc.wantErr, gotErr) if tc.wantErr != nil { return } diff --git a/pkg/markdown/base_test.go b/pkg/markdown/base_test.go index dd1d243..953f8af 100644 --- a/pkg/markdown/base_test.go +++ b/pkg/markdown/base_test.go @@ -3,7 +3,7 @@ package markdown import ( "testing" - "github.com/haunt98/changeloguru/pkg/comparision" + "github.com/stretchr/testify/assert" ) func TestHeaderToString(t *testing.T) { @@ -33,7 +33,7 @@ func TestHeaderToString(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { got := tc.header.ToString() - comparision.Diff(t, tc.want, got) + assert.Equal(t, tc.want, got) }) } } @@ -56,7 +56,7 @@ func TestListItemToString(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { got := tc.listItem.ToString() - comparision.Diff(t, tc.want, got) + assert.Equal(t, tc.want, got) }) } }