MCPcopy
hub / github.com/stretchr/testify / IsMethodCallable

Method IsMethodCallable

mock/mock.go:717–739  ·  mock/mock.go::Mock.IsMethodCallable

IsMethodCallable checking that the method can be called If the method was called more than `Repeatability` return false

(t TestingT, methodName string, arguments ...interface{})

Source from the content-addressed store, hash-verified

715// IsMethodCallable checking that the method can be called
716// If the method was called more than `Repeatability` return false
717func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool {
718 if h, ok := t.(tHelper); ok {
719 h.Helper()
720 }
721 m.mutex.Lock()
722 defer m.mutex.Unlock()
723
724 for _, v := range m.ExpectedCalls {
725 if v.Method != methodName {
726 continue
727 }
728 if len(arguments) != len(v.Arguments) {
729 continue
730 }
731 if v.Repeatability < v.totalCalls {
732 continue
733 }
734 if isArgsEqual(v.Arguments, arguments) {
735 return true
736 }
737 }
738 return false
739}
740
741// isArgsEqual compares arguments
742func isArgsEqual(expected Arguments, args []interface{}) bool {

Callers 1

Calls 2

isArgsEqualFunction · 0.85
HelperMethod · 0.65

Tested by 1