diff --git a/src/meck.erl b/src/meck.erl
index 9f847bdb..069d9274 100644
--- a/src/meck.erl
+++ b/src/meck.erl
@@ -108,7 +108,6 @@
%% It is used in {@link expect/3} and {@link expect/4} to define a function
%% clause of complex multi-clause expectations.
-
%%%============================================================================
%%% Interface exports
%%%============================================================================
@@ -120,7 +119,6 @@
new(Mod) when is_atom(Mod) -> new(Mod, []);
new(Mod) when is_list(Mod) -> lists:foreach(fun new/1, Mod), ok.
-
%% @doc Creates new mocked module(s).
%%
%% This replaces the current version (if any) of the modules in `Mod'
@@ -180,7 +178,6 @@ new(Mod, Options) when is_list(Mod) ->
lists:foreach(fun(M) -> new(M, Options) end, Mod),
ok.
-
%% @doc Add expectation for a function `Func' to the mocked modules `Mod'.
%%
%% An expectation is either of the following:
@@ -214,7 +211,6 @@ expect(Mod, Func, Expectation) when is_atom(Mod), is_atom(Func) ->
Expect = meck_expect:new(Func, Expectation),
check_expect_result(meck_proc:set_expect(Mod, Expect)).
-
%% @doc Adds an expectation with the supplied arity and return value.
%%
%% This creates an expectation which takes `Arity' number of functions
@@ -234,7 +230,6 @@ expect(Mod, Func, AriOrArgs, RetSpec) when is_atom(Mod), is_atom(Func) ->
Expect = meck_expect:new(Func, AriOrArgs, RetSpec),
check_expect_result(meck_proc:set_expect(Mod, Expect)).
-
%% @equiv expect(Mod, Func, Ari, seq(Sequence))
%% @deprecated Please use {@link expect/3} or {@link expect/4} along with
%% {@link ret_spec()} generated by {@link seq/1}.
@@ -252,7 +247,6 @@ sequence(Mod, Func, Ari, Sequence) when is_list(Mod) ->
lists:foreach(fun(M) -> sequence(M, Func, Ari, Sequence) end, Mod),
ok.
-
%% @equiv expect(Mod, Func, Ari, loop(Loop))
%% @deprecated Please use {@link expect/3} or {@link expect/4} along with
%% {@link ret_spec()} generated by {@link loop/1}.
@@ -270,7 +264,6 @@ loop(Mod, Func, Ari, Loop) when is_list(Mod) ->
lists:foreach(fun(M) -> loop(M, Func, Ari, Loop) end, Mod),
ok.
-
%% @doc Deletes an expectation.
%%
%% Deletes the expectation for the function `Func' with the matching
@@ -287,7 +280,6 @@ delete(Mod, Func, Ari) when is_list(Mod) ->
lists:foreach(fun(M) -> delete(M, Func, Ari) end, Mod),
ok.
-
%% @doc Throws an expected exception inside an expect fun.
%%
%% This exception will get thrown without invalidating the mocked
@@ -301,7 +293,6 @@ delete(Mod, Func, Ari) when is_list(Mod) ->
exception(Class, Reason) when Class == throw; Class == error; Class == exit ->
erlang:throw(meck_ret_spec:raise(Class, Reason)).
-
%% @doc Calls the original function (if existing) inside an expectation fun.
%%
%% Note: this code should only be used inside an expect fun.
@@ -312,7 +303,6 @@ passthrough(Args) when is_list(Args) ->
{Mod, Func} = meck_code_gen:get_current_call(),
erlang:apply(meck_util:original_name(Mod), Func, Args).
-
%% @doc Validate the state of the mock module(s).
%%
%% The function returns `true' if the mocked module(s) has been used
@@ -330,7 +320,6 @@ validate(Mod) when is_atom(Mod) ->
validate(Mod) when is_list(Mod) ->
not lists:member(false, [validate(M) || M <- Mod]).
-
%% @doc Return the call history of the mocked module for all processes.
%%
%% @equiv history(Mod, '_')
@@ -338,7 +327,6 @@ validate(Mod) when is_list(Mod) ->
Mod :: atom().
history(Mod) when is_atom(Mod) -> meck_history:get_history('_', Mod).
-
%% @doc Return the call history of the mocked module for the specified process.
%%
%% Returns a list of calls to the mocked module and their results for
@@ -357,7 +345,6 @@ history(Mod, OptCallerPid)
when is_atom(Mod), is_pid(OptCallerPid) orelse OptCallerPid == '_' ->
meck_history:get_history(OptCallerPid, Mod).
-
%% @doc Unloads all mocked modules from memory.
%%
%% The function returns the list of mocked modules that were unloaded
@@ -367,7 +354,6 @@ history(Mod, OptCallerPid)
Mod :: atom().
unload() -> lists:foldl(fun unload_if_mocked/2, [], registered()).
-
%% @doc Unload a mocked module or a list of mocked modules.
%%
%% This will purge and delete the module(s) from the Erlang virtual
@@ -383,7 +369,6 @@ unload(Mod) when is_atom(Mod) ->
unload(Mods) when is_list(Mods) ->
lists:foreach(fun unload/1, Mods), ok.
-
%% @doc Returns whether `Mod:Func' has been called with `Args'.
%%
%% @equiv called(Mod, Fun, Args, '_')
@@ -394,7 +379,6 @@ unload(Mods) when is_list(Mods) ->
called(Mod, OptFun, OptArgs) ->
meck_history:num_calls('_', Mod, OptFun, OptArgs) > 0.
-
%% @doc Returns whether `Pid' has called `Mod:Func' with `Args'.
%%
%% This will check the history for the module, `Mod', to determine
@@ -413,7 +397,6 @@ called(Mod, OptFun, OptArgs) ->
called(Mod, OptFun, OptArgs, OptPid) ->
meck_history:num_calls(OptPid, Mod, OptFun, OptArgs) > 0.
-
%% @doc Returns the number of times `Mod:Func' has been called with `Args'.
%%
%% @equiv num_calls(Mod, Fun, Args, '_')
@@ -424,7 +407,6 @@ called(Mod, OptFun, OptArgs, OptPid) ->
num_calls(Mod, OptFun, OptArgs) ->
meck_history:num_calls('_', Mod, OptFun, OptArgs).
-
%% @doc Returns the number of times process `Pid' has called `Mod:Func'
%% with `Args'.
%%
@@ -441,7 +423,6 @@ num_calls(Mod, OptFun, OptArgs) ->
num_calls(Mod, OptFun, OptArgs, OptPid) ->
meck_history:num_calls(OptPid, Mod, OptFun, OptArgs).
-
%% @doc Erases the call history for a mocked module or a list of mocked modules.
%%
%% This function will erase all calls made heretofore from the history of the
@@ -455,7 +436,6 @@ reset(Mod) when is_atom(Mod) ->
reset(Mods) when is_list(Mods) ->
lists:foreach(fun(Mod) -> reset(Mod) end, Mods).
-
%% @doc Converts a list of terms into {@link ret_spec()} defining a loop of
%% values. It is intended to be in construction of clause specs for the
%% {@link expect/3} function.
@@ -467,7 +447,6 @@ reset(Mods) when is_list(Mods) ->
Loop :: [ret_spec()].
loop(Loop) -> meck_ret_spec:loop(Loop).
-
%% @doc Converts a list of terms into {@link ret_spec()} defining a sequence of
%% values. It is intended to be in construction of clause specs for the
%% {@link expect/3} function.
@@ -479,7 +458,6 @@ loop(Loop) -> meck_ret_spec:loop(Loop).
Sequence :: [ret_spec()].
seq(Sequence) -> meck_ret_spec:seq(Sequence).
-
%% @doc Converts a term into {@link ret_spec()} defining an individual value.
%% It is intended to be in construction of clause specs for the
%% {@link expect/3} function.
@@ -487,7 +465,6 @@ seq(Sequence) -> meck_ret_spec:seq(Sequence).
Value :: any().
val(Value) -> meck_ret_spec:val(Value).
-
%% @doc Creates a {@link ret_spec()} that defines an exception.
%%
%% Calls to an expect, created with {@link ret_spec()} returned by this function,
@@ -497,7 +474,6 @@ val(Value) -> meck_ret_spec:val(Value).
Reason :: term.
raise(Class, Reason) -> meck_ret_spec:raise(Class, Reason).
-
%% @doc Creates a {@link ret_spec()} that makes the original module function be
%% called.
%%
@@ -506,14 +482,12 @@ raise(Class, Reason) -> meck_ret_spec:raise(Class, Reason).
-spec passthrough() -> ret_spec().
passthrough() -> meck_ret_spec:passthrough().
-
%% @doc Creates a {@link ret_spec()} from a function. Calls to an expect,
%% created with {@link ret_spec()} returned by this function, will be forwarded
%% to the specified function.
-spec exec(fun()) -> ret_spec().
exec(Fun) -> meck_ret_spec:exec(Fun).
-
%% @doc creates a {@link matcher/0} instance from either `Predicate' or
%% `HamcrestMatcher'.
%%
@@ -531,7 +505,6 @@ exec(Fun) -> meck_ret_spec:exec(Fun).
is(MatcherImpl) ->
meck_matcher:new(MatcherImpl).
-
%%%============================================================================
%%% Internal functions
%%%============================================================================
@@ -541,7 +514,6 @@ wait_for_exit(Mod) ->
MonitorRef = erlang:monitor(process, meck_util:proc_name(Mod)),
receive {'DOWN', MonitorRef, _Type, _Object, _Info} -> ok end.
-
-spec unload_if_mocked(Mod::atom() | string(), Unloaded::[atom()]) ->
NewUnloaded::[atom()].
unload_if_mocked(Mod, Unloaded) when is_atom(Mod) ->
@@ -562,7 +534,6 @@ unload_if_mocked(ModName, Unloaded) when length(ModName) > 5 ->
unload_if_mocked(_P, Unloaded) ->
Unloaded.
-
-spec check_expect_result(ok | {error, Reason::any()}) -> ok.
check_expect_result(ok) -> ok;
check_expect_result({error, Reason}) -> erlang:error(Reason).
diff --git a/src/meck_code_gen.erl b/src/meck_code_gen.erl
index 9b8a59b6..c09d4000 100644
--- a/src/meck_code_gen.erl
+++ b/src/meck_code_gen.erl
@@ -24,34 +24,25 @@
%% Exported to be accessible from generated modules.
-export([exec/4]).
-
%%%============================================================================
%%% Definitions
%%%============================================================================
-define(CURRENT_CALL, '$meck_call').
-
-define(call(Module, Function, Arguments),
{call, ?LINE,
{remote, ?LINE, ?atom(Module), ?atom(Function)},
Arguments}).
-define(atom(Atom), {atom, ?LINE, Atom}).
-
-define(integer(Integer), {integer, ?LINE, Integer}).
-
-define(var(Name), {var, ?LINE, Name}).
-
-define(attribute(Attribute, Args), {attribute, ?LINE, Attribute, Args}).
-
-define(function(Name, Arity, Clauses),
{function, ?LINE, Name, Arity, Clauses}).
-
-define(clause(Arguments, Body), {clause, ?LINE, Arguments, [], Body}).
-
-define(tuple(Elements), {tuple, ?LINE, Elements}).
-
%%%============================================================================
%%% API
%%%============================================================================
@@ -60,12 +51,10 @@ to_forms(Mod, Expects) ->
{Exports, Functions} = functions(Mod, Expects),
[?attribute(module, Mod)] ++ attributes(Mod) ++ Exports ++ Functions.
-
-spec get_current_call() -> {Mod::atom(), Func::atom()}.
get_current_call() ->
get(?CURRENT_CALL).
-
%%%============================================================================
%%% Internal functions
%%%============================================================================
@@ -79,7 +68,6 @@ attributes(Mod) ->
error:undef -> []
end.
-
functions(Mod, Expects) ->
dict:fold(fun(Export, Expect, {Exports, Functions}) ->
{[?attribute(export, [Export]) | Exports],
@@ -88,7 +76,6 @@ functions(Mod, Expects) ->
{[], []},
Expects).
-
func(Mod, {Func, Arity}, {anon, Arity, Result}) ->
case contains_opaque(Result) of
true ->
@@ -99,7 +86,6 @@ func(Mod, {Func, Arity}, {anon, Arity, Result}) ->
func(Mod, {Func, Arity}, _Expect) ->
func_exec(Mod, Func, Arity).
-
func_exec(Mod, Func, Arity) ->
Args = args(Arity),
?function(Func, Arity,
@@ -110,7 +96,6 @@ func_exec(Mod, Func, Arity) ->
?atom(Func),
list(Args)])])]).
-
func_native(Mod, Func, Arity, Result) ->
Args = args(Arity),
AbsResult = erl_parse:abstract(Result),
@@ -127,7 +112,6 @@ func_native(Mod, Func, Arity, Result) ->
AbsResult])])]),
AbsResult])]).
-
contains_opaque(Term) when is_pid(Term); is_port(Term); is_function(Term);
is_reference(Term) ->
true;
@@ -138,18 +122,14 @@ contains_opaque(Term) when is_tuple(Term) ->
contains_opaque(_Term) ->
false.
-
args(0) -> [];
args(Arity) -> [?var(var_name(N)) || N <- lists:seq(1, Arity)].
-
list([]) -> {nil, ?LINE};
list([H|T]) -> {cons, ?LINE, H, list(T)}.
-
var_name(A) -> list_to_atom("A"++integer_to_list(A)).
-
%% @hidden
-spec exec(CallerPid::pid(), Mod::atom(), Func::atom(), Args::[any()]) ->
Result::any().
@@ -172,7 +152,6 @@ exec(Pid, Mod, Func, Args) ->
end
end.
-
-spec handle_exception(CallerPid::pid(), Mod::atom(), Func::atom(),
Args::[any()], Class:: exit | error | throw,
Reason::any()) ->
@@ -186,7 +165,6 @@ handle_exception(Pid, Mod, Func, Args, Class, Reason) ->
raise(Pid, Mod, Func, Args, Class, Reason)
end.
-
-spec raise(CallerPid::pid(), Mod::atom(), Func::atom(), Args::[any()],
Class:: exit | error | throw, Reason::any()) ->
no_return().
@@ -195,7 +173,6 @@ raise(Pid, Mod, Func, Args, Class, Reason) ->
meck_proc:add_history(Mod, Pid, Func, Args, {Class, Reason, StackTrace}),
erlang:raise(Class, Reason, StackTrace).
-
-spec inject(Mod::atom(), Func::atom(), Args::[any()],
meck_history:stack_trace()) ->
NewStackTrace::meck_history:stack_trace().
diff --git a/src/meck_history.erl b/src/meck_history.erl
index 76d31241..8d4d9aea 100644
--- a/src/meck_history.erl
+++ b/src/meck_history.erl
@@ -55,7 +55,6 @@
-type opt_pid() :: pid() | '_'.
-type opt_func() :: atom() | '_'.
-
%%%============================================================================
%%% API
%%%============================================================================
@@ -68,7 +67,6 @@ get_history(CallerPid, Mod) ->
lists:filter(new_filter(CallerPid, '_', ArgsMatcher),
meck_proc:get_history(Mod)).
-
-spec num_calls(opt_pid(), Mod::atom(), opt_func(),
meck_args_matcher:opt_args_spec()) ->
non_neg_integer().
@@ -78,7 +76,6 @@ num_calls(CallerPid, Mod, OptFunc, OptArgsSpec) ->
Filtered = lists:filter(Filter, meck_proc:get_history(Mod)),
length(Filtered).
-
%%%============================================================================
%%% Internal functions
%%%============================================================================
diff --git a/src/meck_proc.erl b/src/meck_proc.erl
index d295420b..2b35b61f 100644
--- a/src/meck_proc.erl
+++ b/src/meck_proc.erl
@@ -41,7 +41,6 @@
terminate/2,
code_change/3]).
-
%%%============================================================================
%%% Definitions
%%%============================================================================
@@ -56,7 +55,6 @@
reload :: {Compiler::pid(), {From::pid(), Tag::any()}} |
undefined}).
-
%%%============================================================================
%%% API
%%%============================================================================
@@ -73,24 +71,20 @@ start(Mod, Options) ->
gen_server:StartFunc({local, meck_util:proc_name(Mod)}, ?MODULE,
[Mod, Options], [{spawn_opt, SpawnOpt}]).
-
-spec get_result_spec(Mod::atom(), Func::atom(), Args::[any()]) ->
meck_ret_spec:result_spec() | undefined.
get_result_spec(Mod, Func, Args) ->
gen_server(call, Mod, {get_result_spec, Func, Args}).
-
-spec set_expect(Mod::atom(), meck_expect:expect()) ->
ok | {error, Reason :: any()}.
set_expect(Mod, Expect) ->
gen_server(call, Mod, {set_expect, Expect}).
-
-spec delete_expect(Mod::atom(), Func::atom(), Ari::byte()) -> ok.
delete_expect(Mod, Func, Ari) ->
gen_server(call, Mod, {delete_expect, Func, Ari}).
-
-spec add_history(Mod::atom(), CallerPid::pid(), Func::atom(), Args::[any()],
Result::any()) ->
ok.
@@ -99,32 +93,26 @@ add_history(Mod, CallerPid, Func, Args, {Class, Reason, StackTrace}) ->
add_history(Mod, CallerPid, Func, Args, Result) ->
gen_server(cast, Mod, {add_history, {CallerPid, {Mod, Func, Args}, Result}}).
-
-spec get_history(Mod::atom()) -> meck_history:history().
get_history(Mod) ->
gen_server(call, Mod, get_history).
-
-spec reset(Mod::atom()) -> ok.
reset(Mod) ->
gen_server(call, Mod, reset).
-
-spec validate(Mod::atom()) -> boolean().
validate(Mod) ->
gen_server(call, Mod, validate).
-
-spec invalidate(Mod::atom()) -> ok.
invalidate(Mod) ->
gen_server(call, Mod, invalidate).
-
-spec stop(Mod::atom()) -> ok.
stop(Mod) ->
gen_server(call, Mod, stop).
-
%%%============================================================================
%%% gen_server callbacks
%%%============================================================================
@@ -141,7 +129,7 @@ init([Mod, Options]) ->
Original = backup_original(Mod, NoPassCover),
NoHistory = proplists:get_bool(no_history, Options),
History = if NoHistory -> undefined; true -> [] end,
- CanExpect = resolve_can_expect(Exports, Options),
+ CanExpect = resolve_can_expect(Mod, Exports, Options),
Expects = init_expects(Exports, Options),
process_flag(trap_exit, true),
try
@@ -158,7 +146,6 @@ init([Mod, Options]) ->
{stop, module_is_sticky}
end.
-
%% @hidden
handle_call({get_result_spec, Func, Args}, _From, S) ->
{ResultSpec, NewExpects} = do_get_result_spec(S#state.expects, Func, Args),
@@ -195,7 +182,6 @@ handle_call(validate, _From, S) ->
handle_call(stop, _From, S) ->
{stop, normal, ok, S}.
-
%% @hidden
handle_cast({add_history, _Item}, S = #state{history = undefined}) ->
{noreply, S};
@@ -210,7 +196,6 @@ handle_cast({add_history, Item}, S = #state{reload = Reload}) ->
handle_cast(_Msg, S) ->
{noreply, S}.
-
%% @hidden
handle_info({'EXIT', Pid, _Reason}, S = #state{reload = Reload}) ->
case Reload of
@@ -223,7 +208,6 @@ handle_info({'EXIT', Pid, _Reason}, S = #state{reload = Reload}) ->
handle_info(_Info, S) ->
{noreply, S}.
-
%% @hidden
terminate(_Reason, #state{mod = Mod, original = OriginalState,
was_sticky = WasSticky}) ->
@@ -232,11 +216,9 @@ terminate(_Reason, #state{mod = Mod, original = OriginalState,
restore_original(Mod, OriginalState, WasSticky),
ok.
-
%% @hidden
code_change(_OldVsn, S, _Extra) -> {ok, S}.
-
%%%============================================================================
%%% Internal functions
%%%============================================================================
@@ -250,7 +232,6 @@ normal_exports(Mod) ->
error:undef -> undefined
end.
-
-spec expect_type(Mod::atom(), Func::atom(), Ari::byte()) ->
autogenerated | builtin | normal.
expect_type(_, module_info, 0) -> autogenerated;
@@ -261,7 +242,6 @@ expect_type(Mod, Func, Ari) ->
false -> normal
end.
-
-spec backup_original(Mod::atom(), NoPassCover::boolean()) ->
{Cover:: false |
{File::string(), Data::string(), CompiledOptions::[any()]},
@@ -309,7 +289,6 @@ backup_original(Mod, NoPassCover) ->
{Cover, no_binary} % TODO: What to do here?
end.
-
-spec get_cover_state(Mod::atom()) ->
{File::string(), Data::string(), CompileOptions::[any()]} | false.
get_cover_state(Mod) ->
@@ -328,19 +307,18 @@ get_cover_state(Mod) ->
false
end.
-
--spec resolve_can_expect(Exports::[meck_expect:func_ari()] | undefined,
+-spec resolve_can_expect(Mod::atom(),
+ Exports::[meck_expect:func_ari()] | undefined,
Options::[proplists:property()]) ->
any | [meck_expect:func_ari()].
-resolve_can_expect(Exports, Options) ->
+resolve_can_expect(Mod, Exports, Options) ->
NonStrict = proplists:get_bool(non_strict, Options),
case {Exports, NonStrict} of
{_, true} -> any;
- {undefined, _} -> erlang:exit(undefined_module);
+ {undefined, _} -> erlang:error({undefined_module, Mod});
_ -> Exports
end.
-
-spec init_expects(Exports::[meck_expect:func_ari()] | undefined,
Options::[proplists:property()]) ->
dict().
@@ -368,21 +346,18 @@ init_expects(Exports, Options) ->
end,
dict:new(), Expects).
-
-spec gen_server(Method:: call | cast, Mod::atom(), Msg::tuple() | atom()) -> any().
gen_server(Func, Mod, Msg) ->
Name = meck_util:proc_name(Mod),
try gen_server:Func(Name, Msg)
catch exit:_Reason -> erlang:error({not_mocked, Mod}) end.
-
-spec check_if_being_reloaded(#state{}) -> ok.
check_if_being_reloaded(#state{reload = undefined}) ->
ok;
check_if_being_reloaded(_S) ->
erlang:error(concurrent_reload).
-
-spec do_get_result_spec(Expects::dict(), Func::atom(), Args::[any()]) ->
{meck_ret_spec:result_spec() | undefined, NewExpects::dict()}.
do_get_result_spec(Expects, Func, Args) ->
@@ -397,7 +372,6 @@ do_get_result_spec(Expects, Func, Args) ->
end,
{ResultSpec, NewExpects}.
-
-spec validate_expect(Mod::atom(), Func::atom(), Ari::byte(),
CanExpect::any | [meck_expect:func_ari()]) ->
ok | {error, Reason::any()}.
@@ -414,7 +388,6 @@ validate_expect(Mod, Func, Ari, CanExpect) ->
end
end.
-
-spec store_expect(Mod::atom(), meck_expect:func_ari(),
meck_expect:expect(), Expects::dict()) ->
{NewExpects::dict(), CompilerPid::pid()}.
@@ -422,14 +395,12 @@ store_expect(Mod, FuncAri, Expect, Expects) ->
NewExpects = dict:store(FuncAri, Expect, Expects),
compile_expects(Mod, NewExpects).
-
-spec do_delete_expect(Mod::atom(), meck_expect:func_ari(), Expects::dict()) ->
{NewExpects::dict(), CompilerPid::pid()}.
do_delete_expect(Mod, FuncAri, Expects) ->
NewExpects = dict:erase(FuncAri, Expects),
compile_expects(Mod, NewExpects).
-
-spec compile_expects(Mod::atom(), Expects::dict()) ->
{NewExpects::dict(), CompilerPid::pid()}.
compile_expects(Mod, Expects) ->
@@ -442,7 +413,6 @@ compile_expects(Mod, Expects) ->
end),
{Expects, CompilerPid}.
-
restore_original(Mod, {false, _}, WasSticky) ->
restick_original(Mod, WasSticky),
ok;
@@ -479,7 +449,6 @@ export_original_cover(Mod, {_, Bin}) when is_binary(Bin) ->
export_original_cover(_, _) ->
ok.
-
unstick_original(Module) -> unstick_original(Module, code:is_sticky(Module)).
unstick_original(Module, true) -> code:unstick_mod(Module);
@@ -491,7 +460,6 @@ restick_original(Module, true) ->
ok;
restick_original(_,_) -> ok.
-
-spec cleanup(Mod::atom()) -> boolean().
cleanup(Mod) ->
code:purge(Mod),
diff --git a/src/meck_util.erl b/src/meck_util.erl
index 9cb0929e..2046310e 100644
--- a/src/meck_util.erl
+++ b/src/meck_util.erl
@@ -23,7 +23,6 @@
original_name/1,
match_spec_item/1]).
-
%%%============================================================================
%%% Types
%%%============================================================================
@@ -37,11 +36,9 @@
-spec proc_name(Mod::atom()) -> MockMod::atom().
proc_name(Name) -> list_to_atom(atom_to_list(Name) ++ "_meck").
-
-spec original_name(Mod::atom()) -> OrigMod::atom().
original_name(Name) -> list_to_atom(atom_to_list(Name) ++ "_meck_original").
-
-spec match_spec_item(Pattern::tuple()) -> match_spec_item().
match_spec_item(Pattern) ->
{Pattern, [], ['$_']}.
diff --git a/test/meck_tests.erl b/test/meck_tests.erl
index 018edb91..b6d237fc 100644
--- a/test/meck_tests.erl
+++ b/test/meck_tests.erl
@@ -209,7 +209,6 @@ stacktrace_function_clause_(Mod) ->
end, Stacktrace))
end.
-
call_undef_(Mod) ->
ok = meck:expect(Mod, test, fun(hest, 1) -> apa end),
?assertError(undef, Mod:test(hest)).
@@ -770,12 +769,11 @@ expect_ret_specs_(Mod) ->
?assertEqual(e, Mod:f(1, 2)),
?assertEqual(c, Mod:f(1, 1)).
-
%% --- Tests with own setup ----------------------------------------------------
undefined_module_test() ->
%% When/Then
- ?assertError(undefined_module, meck:new(blah, [no_link])).
+ ?assertError({{undefined_module, blah}, _}, meck:new(blah, [no_link])).
undefined_function_test() ->
%% Given