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

Method Maybe

mock/mock.go:192–197  ·  view source on GitHub ↗

Maybe allows the method call to be optional. Not calling an optional method will not cause an error while asserting expectations

()

Source from the content-addressed store, hash-verified

190// Maybe allows the method call to be optional. Not calling an optional method
191// will not cause an error while asserting expectations
192func (c *Call) Maybe() *Call {
193 c.lock()
194 defer c.unlock()
195 c.optional = true
196 return c
197}
198
199// On chains a new expectation description onto the mocked interface. This
200// allows syntax like.

Callers 1

Test_Mock_AssertOptionalFunction · 0.80

Calls 2

lockMethod · 0.95
unlockMethod · 0.95

Tested by 1

Test_Mock_AssertOptionalFunction · 0.64