Skip to content

Commit 5580d80

Browse files
committed
fix: do not call methodWasCalled
removed isArgsEqual as well
1 parent dbee393 commit 5580d80

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

mock/mock.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -712,30 +712,15 @@ func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...inter
712712
return true
713713
}
714714

715-
// IsMethodCallable checking that the method can be called
716-
// If the method was called more than `Repeatability` return false
715+
// IsMethodCallable returns true if the methodName and arguments are currently expected
717716
func (m *Mock) IsMethodCallable(_ TestingT, methodName string, arguments ...interface{}) bool {
718717
m.mutex.Lock()
719718
defer m.mutex.Unlock()
720719
index, _ := m.findExpectedCall(methodName, arguments...)
721720
if index != -1 {
722721
return true
723722
}
724-
// return false if call was not expected
725-
return m.methodWasCalled(methodName, arguments)
726-
}
727-
728-
// isArgsEqual compares arguments
729-
func isArgsEqual(expected Arguments, args []interface{}) bool {
730-
if len(expected) != len(args) {
731-
return false
732-
}
733-
for i, v := range args {
734-
if !reflect.DeepEqual(expected[i], v) {
735-
return false
736-
}
737-
}
738-
return true
723+
return false
739724
}
740725

741726
func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool {

mock/mock_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,19 +1731,6 @@ func Test_Mock_IsMethodCallable(t *testing.T) {
17311731
})
17321732
}
17331733

1734-
func TestIsArgsEqual(t *testing.T) {
1735-
var expected = Arguments{5, 3, 4, 6, 7, 2}
1736-
1737-
// Copy elements 1 to 5
1738-
args := append(([]interface{})(nil), expected[1:]...)
1739-
args[2] = expected[1]
1740-
assert.False(t, isArgsEqual(expected, args))
1741-
1742-
// Clone
1743-
arr := append(([]interface{})(nil), expected...)
1744-
assert.True(t, isArgsEqual(expected, arr))
1745-
}
1746-
17471734
func Test_Mock_AssertOptional(t *testing.T) {
17481735
// Optional called
17491736
var ms1 = new(TestExampleImplementation)

0 commit comments

Comments
 (0)