Improved the way stubs and callbacks deal with call counts (Implements #132)

This commit is contained in:
Mark VanderVoord
2026-06-30 10:15:18 -04:00
parent dd922f17b0
commit ebdc8ee128
3 changed files with 30 additions and 6 deletions
+8
View File
@@ -294,6 +294,14 @@ order (based on any Expects you've set up) before calling the callback.
to the callback instead. In this case, you are replacing the normal mock calls
with your own custom stub function.
Calling either `func_AddCallback` or `func_Stub` resets the call count for
that function to zero, so `NumCalls` always reflects calls made since the
current stub or callback was installed.
You can read the current call count at any time using `func_CallCount()`.
This is useful when you need to verify how many times a stub was invoked
without setting up formal Expects.
There is also an older name, `func_StubWithCallback`, which is just an alias
for either `func_AddCallback` or `func_Stub` depending on setting of the
`:callback_after_arg_check` toggle. This is deprecated and we recommend using