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

Function TestClosestCallFavorsFirstMock

mock/mock_test.go:2284–2300  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2282}
2283
2284func TestClosestCallFavorsFirstMock(t *testing.T) {
2285 t.Parallel()
2286
2287 defer func() {
2288 if r := recover(); r != nil {
2289 diffRegExp := `Difference found in argument 0:\s+--- Expected\s+\+\+\+ Actual\s+@@ -2,4 \+2,4 @@\s+\(bool\) true,\s+- \(bool\) true,\s+- \(bool\) true\s+\+ \(bool\) false,\s+\+ \(bool\) false\s+}\s+Diff: 0: FAIL: \(\[\]bool=\[(true\s?|false\s?){3}]\) != \(\[\]bool=\[(true\s?|false\s?){3}\]\)`
2290 matchingExp := regexp.MustCompile(unexpectedCallRegex(`TheExampleMethod7([]bool)`, `0: \[\]bool{true, false, false}`, `0: \[\]bool{true, true, true}`, diffRegExp))
2291 assert.Regexp(t, matchingExp, r)
2292 }
2293 }()
2294
2295 m := new(TestExampleImplementation)
2296 m.On("TheExampleMethod7", []bool{true, true, true}).Return(nil).Once()
2297 m.On("TheExampleMethod7", []bool{false, false, false}).Return(nil).Once()
2298
2299 m.TheExampleMethod7([]bool{true, false, false})
2300}
2301
2302func TestClosestCallUsesRepeatabilityToFindClosest(t *testing.T) {
2303 t.Parallel()

Callers

nothing calls this directly

Calls 6

RegexpFunction · 0.92
unexpectedCallRegexFunction · 0.85
OnceMethod · 0.80
ReturnMethod · 0.80
TheExampleMethod7Method · 0.80
OnMethod · 0.45

Tested by

no test coverage detected