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

Method checkExpectation

mock/mock.go:651–659  ·  view source on GitHub ↗
(call *Call)

Source from the content-addressed store, hash-verified

649}
650
651func (m *Mock) checkExpectation(call *Call) (bool, string) {
652 if !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 {
653 return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo)
654 }
655 if call.Repeatability > 0 {
656 return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo)
657 }
658 return true, fmt.Sprintf("PASS:\t%s(%s)", call.Method, call.Arguments.String())
659}
660
661// AssertNumberOfCalls asserts that the method was called expectedCalls times.
662func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool {

Callers 2

AssertExpectationsMethod · 0.95
MethodCalledMethod · 0.80

Calls 2

methodWasCalledMethod · 0.95
StringMethod · 0.45

Tested by

no test coverage detected