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

Method findClosestCall

mock/mock.go:433–452  ·  view source on GitHub ↗
(method string, arguments ...interface{})

Source from the content-addressed store, hash-verified

431}
432
433func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) {
434 var bestMatch matchCandidate
435
436 for _, call := range m.expectedCalls() {
437 if call.Method == method {
438
439 errInfo, tempDiffCount := call.Arguments.Diff(arguments)
440 tempCandidate := matchCandidate{
441 call: call,
442 mismatch: errInfo,
443 diffCount: tempDiffCount,
444 }
445 if tempCandidate.isBetterMatchThan(bestMatch) {
446 bestMatch = tempCandidate
447 }
448 }
449 }
450
451 return bestMatch.call, bestMatch.mismatch
452}
453
454func callString(method string, arguments Arguments, includeArgumentValues bool) string {
455 var argValsString string

Callers 1

MethodCalledMethod · 0.95

Calls 3

expectedCallsMethod · 0.95
isBetterMatchThanMethod · 0.95
DiffMethod · 0.80

Tested by

no test coverage detected