Skip to content

Commit

Permalink
Merge pull request #1444 from stretchr/mock-refactor-TestIsArgsEqual
Browse files Browse the repository at this point in the history
mock: refactor TestIsArgsEqual
  • Loading branch information
MovieStoreGuy committed Jan 21, 2024
2 parents 12f05f7 + c740480 commit 24e57f1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions mock/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1616,17 +1616,14 @@ func Test_Mock_IsMethodCallable(t *testing.T) {

func TestIsArgsEqual(t *testing.T) {
var expected = Arguments{5, 3, 4, 6, 7, 2}
var args = make([]interface{}, 5)
for i := 1; i < len(expected); i++ {
args[i-1] = expected[i]
}

// Copy elements 1 to 5
args := append(([]interface{})(nil), expected[1:]...)
args[2] = expected[1]
assert.False(t, isArgsEqual(expected, args))

var arr = make([]interface{}, 6)
for i := 0; i < len(expected); i++ {
arr[i] = expected[i]
}
// Clone
arr := append(([]interface{})(nil), expected...)
assert.True(t, isArgsEqual(expected, arr))
}

Expand Down

0 comments on commit 24e57f1

Please sign in to comment.