You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/09/28 21:02:26 UTC

[18/50] meck commit: updated refs/heads/master to 3544aca

Add call to stacktrace when missing (fix #167)


Project: http://git-wip-us.apache.org/repos/asf/couchdb-meck/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-meck/commit/e182a999
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-meck/tree/e182a999
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-meck/diff/e182a999

Branch: refs/heads/master
Commit: e182a999ad238ae8ac21bfd885e85dc9c82c6976
Parents: 44e4d4a
Author: Adam Lindberg <he...@alind.io>
Authored: Mon Feb 13 13:18:26 2017 +0100
Committer: Adam Lindberg <he...@alind.io>
Committed: Mon Feb 13 13:18:26 2017 +0100

----------------------------------------------------------------------
 src/meck_code_gen.erl | 4 ++--
 test/meck_tests.erl   | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-meck/blob/e182a999/src/meck_code_gen.erl
----------------------------------------------------------------------
diff --git a/src/meck_code_gen.erl b/src/meck_code_gen.erl
index e7e6736..918161b 100644
--- a/src/meck_code_gen.erl
+++ b/src/meck_code_gen.erl
@@ -190,8 +190,8 @@ raise(Pid, Mod, Func, Args, Class, Reason) ->
 -spec inject(Mod::atom(), Func::atom(), Args::[any()],
              meck_history:stack_trace()) ->
         NewStackTrace::meck_history:stack_trace().
-inject(_Mod, _Func, _Args, []) ->
-    [];
+inject(Mod, Func, Args, []) ->
+    [{Mod, Func, Args}];
 inject(Mod, Func, Args, [{?MODULE, exec, _AriOrArgs, _Loc}|Stack]) ->
     [{Mod, Func, Args} | Stack];
 inject(Mod, Func, Args, [{?MODULE, exec, _AriOrArgs}|Stack]) ->

http://git-wip-us.apache.org/repos/asf/couchdb-meck/blob/e182a999/test/meck_tests.erl
----------------------------------------------------------------------
diff --git a/test/meck_tests.erl b/test/meck_tests.erl
index 3ea4de2..5e8dda4 100644
--- a/test/meck_tests.erl
+++ b/test/meck_tests.erl
@@ -75,6 +75,7 @@ meck_test_() ->
                            fun ?MODULE:shortcut_call_argument_/1,
                            fun ?MODULE:shortcut_re_add_/1,
                            fun ?MODULE:shortcut_opaque_/1,
+                           fun ?MODULE:shortcut_stacktrace_/1,
                            fun ?MODULE:delete_/1,
                            fun ?MODULE:called_false_no_args_/1,
                            fun ?MODULE:called_true_no_args_/1,
@@ -396,6 +397,13 @@ shortcut_opaque_(Mod) ->
     ok = meck:expect(Mod, test, 0, {test, [a, self()], Ref}),
     ?assertMatch({test, [a, P], Ref} when P == self(), Mod:test()).
 
+shortcut_stacktrace_(Mod) ->
+    ok = meck:expect(Mod, test, [true], ok),
+    ?assertEqual(
+        {'EXIT', {function_clause, [{mymod, test, [false], []}]}},
+        catch(Mod:test(false))
+    ).
+
 delete_(Mod) ->
     ok = meck:expect(Mod, test, 2, ok),
     ?assertEqual(ok, meck:delete(Mod, test, 2)),