Closed decibel closed 4 months ago
The whole setup to keep track of calls is quite messy because the original package exposed too much of its internals like Repeatability
, which means we cannot change that behaviour without introducing a breaking change.
We can definitely improve on the error message and specify that calls have been exhausted on the closest call.
Something like:
mock: Unexpected Method Call
---------------------------
MyFunc(...)
0: 'a'
The closest call I have is:
MyFunc(...) - Total calls received: 3 (maximum reached)
0: 'a'
If too many calls with the same exact inputs happen, the error report is extremely confusing:
I think the best way to handle this would be for Mock.MethodCalled() to include
closestCall.totalCalls
in it's output somehow. Is there a better way?It would also be nice to report how many calls have already occured, vs how many were originally allocated, but that's hard to do since Repeatability gets modified. It seems that Repeatability could just be left alone and totalCalls compared to it, no?