diff options
author | James Fargher <jfargher@gitlab.com> | 2022-10-28 04:19:33 +0300 |
---|---|---|
committer | James Fargher <jfargher@gitlab.com> | 2022-10-28 04:23:14 +0300 |
commit | 0d64f864c4c46a8c40e1cbb3a13347fa654bc1ec (patch) | |
tree | e0153b21e02e60ebc9ae79cca6b0504bd3499543 /cmd | |
parent | 42316950890a4dfcf93156160d03656eba06b4a0 (diff) |
gitaly-git2go: Fix cherry pick error checking tests
These tests were trying to assert the error type using errors.As but had
mistakenly converted the targets to type error. This meant that the
assertion always passed because an error is assignable to an error.
Instead pass an empty interface to avoid the conversion.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gitaly-git2go/cherry_pick_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cmd/gitaly-git2go/cherry_pick_test.go b/cmd/gitaly-git2go/cherry_pick_test.go index 25d1c843f..82f11cd11 100644 --- a/cmd/gitaly-git2go/cherry_pick_test.go +++ b/cmd/gitaly-git2go/cherry_pick_test.go @@ -84,7 +84,7 @@ func TestCherryPick(t *testing.T) { commit []gittest.TreeEntry expected map[string]string expectedCommitID string - expectedErr error + expectedErrAs interface{} expectedErrMsg string }{ { @@ -114,7 +114,7 @@ func TestCherryPick(t *testing.T) { commit: []gittest.TreeEntry{ {Path: "file", Content: "foobar", Mode: "100644"}, }, - expectedErr: git2go.ConflictingFilesError{}, + expectedErrAs: &git2go.ConflictingFilesError{}, expectedErrMsg: "cherry-pick: there are conflicting files", }, { @@ -128,7 +128,7 @@ func TestCherryPick(t *testing.T) { commit: []gittest.TreeEntry{ {Path: "file", Content: "fooqux", Mode: "100644"}, }, - expectedErr: git2go.EmptyError{}, + expectedErrAs: &git2go.EmptyError{}, expectedErrMsg: "cherry-pick: could not apply because the result was empty", }, { @@ -180,8 +180,8 @@ func TestCherryPick(t *testing.T) { if tc.expectedErrMsg != "" { require.EqualError(t, err, tc.expectedErrMsg) - if tc.expectedErr != nil { - require.ErrorAs(t, err, &tc.expectedErr) + if tc.expectedErrAs != nil { + require.ErrorAs(t, err, tc.expectedErrAs) } return } |