Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

TEST test also exceptions in moka_history_tests

  • Loading branch information...
commit 98c55290d2676527f5c495114ecee3ba2951cc36 1 parent de6bf32
@samuelrivas authored
Showing with 15 additions and 7 deletions.
  1. +15 −7 test/unit/moka_history_tests.erl
View
22 test/unit/moka_history_tests.erl
@@ -52,15 +52,18 @@ prop_get_history() ->
history() -> proper_types:list(history_entry()).
-history_entry() -> {description(), args_gen(), return_gen()}.
+history_entry() -> {description(), args_gen(), result_gen()}.
%% Variety doesn't seem relevant for this test case, so we just generate a few
%% possibilities
-description() -> {module_gen(), function_gen()}.
-module_gen() -> proper_types:elements([mod1, mod2, mod3, mod4]).
-function_gen() -> proper_types:elements([fun1, fun2, fun3, fun4]).
-args_gen() -> proper_types:list(proper_types:integer()).
-return_gen() -> {return, proper_types:integer()}.
+description() -> {module_gen(), function_gen()}.
+module_gen() -> proper_types:elements([mod1, mod2, mod3, mod4]).
+function_gen() -> proper_types:elements([fun1, fun2, fun3, fun4]).
+args_gen() -> proper_types:list(proper_types:integer()).
+result_gen() -> proper_types:oneof([return_gen(), exception_gen()]).
+return_gen() -> {return, proper_types:integer()}.
+exception_gen() -> {exception, class(), proper_types:integer()}.
+class() -> proper_types:oneof([throw, exit, error]).
%%%_* Private Functions ================================================
test_server_name() -> moka_history_test_server.
@@ -68,7 +71,12 @@ test_server_name() -> moka_history_test_server.
replay_history(Server, History) ->
lists:foreach(
fun({Description, Args, {return, Result}}) ->
- moka_history:add_return(Server, Description, Args, Result)
+ moka_history:add_return(
+ Server, Description, Args, Result);
+
+ ({Description, Args, {exception, Class, Reason}}) ->
+ moka_history:add_exception(
+ Server, Description, Args, Class, Reason)
end,
History).
Please sign in to comment.
Something went wrong with that request. Please try again.