Fix stdout reporting of shrinking phase
diff --git a/src/triq.erl b/src/triq.erl
index 7d518d7..3d23d74 100644
--- a/src/triq.erl
+++ b/src/triq.erl
@@ -69,7 +69,7 @@
check_input(Fun,Input,IDom,#triq{count=Count}=QCT) ->
try Fun(Input) of
true ->
- report(pass,true),
+ report(pass,true,QCT#triq.shrinking),
{success, Count+1};
{success, NewCount} ->
@@ -110,7 +110,7 @@
end;
{'prop:implies', false, _, _, _} ->
- report(skip,true),
+ report(skip,true,QCT#triq.shrinking),
{success, Count};
{'prop:implies', true, _Syntax, Fun2, Body2} ->
@@ -154,7 +154,7 @@
{'EXIT', PID, Reason} ->
process_flag(trap_exit, WasTrap),
- report(fail, Reason),
+ report(fail, Reason, QCT#triq.shrinking),
{failure, Fun, Input, IDom,
QCT#triq{count=Count+1,result={'EXIT', Reason}}}
@@ -165,12 +165,12 @@
QCT#triq{body=Body2});
Any ->
- report(fail,Any),
+ report(fail, Any, QCT#triq.shrinking),
{failure, Fun, Input, IDom, QCT#triq{count=Count+1,result=Any}}
catch
Class : Exception ->
- report(fail, {Class, Exception, erlang:get_stacktrace()}),
+ report(fail, {Class, Exception, erlang:get_stacktrace()}, QCT#triq.shrinking),
{failure, Fun, Input, IDom, QCT#triq{count=Count+1,
result={'EXIT',Exception}}}
@@ -517,3 +517,7 @@
report(Event, Term) ->
Reporter = reporter(),
Reporter:report(Event, Term).
+
+report(Event, Term, IsShrinking) ->
+ Reporter = reporter(),
+ Reporter:report(Event, Term, IsShrinking).
diff --git a/src/triq_reporter_stdout.erl b/src/triq_reporter_stdout.erl
index ee60bed..3a184fc 100644
--- a/src/triq_reporter_stdout.erl
+++ b/src/triq_reporter_stdout.erl
@@ -1,5 +1,5 @@
-module(triq_reporter_stdout).
--export([report/2]).
+-export([report/2, report/3]).
report(testing, [Module, Fun]) ->
io:format("Testing ~p:~p/0~n", [Module, Fun]);
@@ -19,6 +19,9 @@
report(success, Count) ->
io:format("~nRan ~p tests~n", [Count]).
+report(_Subject, _Data, true) -> ok;
+report(Subject, Data, false) -> report(Subject, Data).
+
print_counter_example(CounterExample) ->
lists:foreach(fun({Syntax,_Fun,Val,_Dom}) ->
io:format("\t~s = ~w~n", [Syntax,Val])