View Source EfxCase.MockState (Efx v0.2.10)
This module implements a global mutable state needed for mocking.
Mocking works by adding the pid of the mock-owning process to it's
dictionary and accessing this pid using a lookup with ProcessTree
.
The pid then can be used to lookup information of the mock, e.g. which function is mocked with replacement or how often a function was called to verify. This module is the global lookup.
We need a global lookup in which we can manipulate data to count mock invocations as well as store mocks as global when a test is flagged as async.
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type scope_t() :: pid() | :global | :omnipresent
Defines the scopes of a binding.
A scope is one of the following
- pid: the binding is bound to a pid
- global: the binding is bound globally, defined with
async: true
- omnipresent: the binding is omnipresent, that is, defined at test bootstrap
Functions
Link to this function
add_fun(pid, behaviour, fun_identifier, arity, fun, num_expected_calls)
View SourceReturns a specification to start this module under a supervisor.
See Supervisor
.
@spec clean_after_test() :: :ok
@spec parse([EfxCase.Mock.MockedFun.t()]) :: String.t()
@spec verify_called!() :: no_return() | nil | :ok