View Source EfxCase.MockState (Efx v0.1.5)
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 pid_t() :: pid() | :global
Functions
Link to this function
add_fun(behaviour, fun_identifier, arity, fun, num_expected_calls)
View Source@spec add_fun(module(), atom(), arity(), (... -> any()), non_neg_integer() | nil) :: :ok
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_globals() :: :ok
@spec parse([EfxCase.Mock.MockedFun.t()]) :: String.t()
@spec verify_called!() :: no_return() | nil | :ok