couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [18/50] meck commit: updated refs/heads/master to 3544aca
Date Thu, 28 Sep 2017 21:02:26 GMT
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 <hello@alind.io>
Authored: Mon Feb 13 13:18:26 2017 +0100
Committer: Adam Lindberg <hello@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)),


Mime
View raw message