Macro

SUSPEND_MOCKS

Suspend all mocks.

Since v1.0
#define SUSPEND_MOCKS(
)

Discussion 🔗

This function suspends all active mocks. It can be called multiple times so long as each call is paired with a call to RESTORE_MOCKS. In this sense, the macros SUSPEND_MOCKS and RESTORE_MOCKS conceptually have a "stacking behavior" where the former is like a "push" operation and the latter is like a "pop" operation. Only once the "stack" is empty are mocks re-enabled.

If a test completes without enough calls to RESTORE_MOCKS, then the implementation will implicitly invoke them to ensure mocks are uninstalled before the next test case starts.