anchor.diff:  -export([handle_end/3]).
   -export([handle_cancel/3]).
   -export([terminate/2]).
  +
  +-export([ioindent/2]).
   
   % Clear line: "\e[2K"
   
  
positive.code: 
  print_failure(Failure) ->
      % io:format("~p~n~n", [Failure]),
      {Type, Error, Reason, Stacktrace, {M, F, A}} = failure_type(Failure),
      Ex = lib:format_exception(4, Error, Reason, Stacktrace,
          fun(_M, _F, _A) -> false end,
          fun(T, I) ->
              {ok, Cols} = io:columns(),
              io_lib_pretty:print(T, I, Cols - 4, -1)
          end
      ),
      Case = io_lib:format("~p:~p/~p", [M, F, A]),
      io:format("~s ~s~n", [format_type(Type), Case]),
      io:format("~s~n", [color:red(ioindent(Ex, 4))]).
  
  failure_type(Failure) ->
      case proplists:get_value(status, Failure, proplists:get_value(reason, Failure)) of
          {error, {E, R, ST}} ->
              {fail, E, R, ST, proplists:get_value(source, Failure)};
          {abort, {setup_failed, {E, R, ST}}} ->
              {M, F, A, _} = hd(ST),
              {cancel, E, R, ST, {M, F, A}}
      end.
  
  format_type(fail) -> color:redb("Failure:");
  format_type(cancel) -> color:yellowb("Cancelled:").
  
  print_summary(Result) ->
      case get_all(Result, [pass, fail, skip, cancel]) of
  
negative.code: iojoin([Item], _Separator)     -> Item;
  iojoin([Item|List], Separator) -> [Item, Separator, iojoin(List, Separator)].
  
  ioindent(Indent, IOData) when is_integer(Indent) ->
      Spacing = lists:duplicate(Indent, 32),
      [Spacing, ioindent(Spacing, IOData)];
  ioindent(Spacing, [Sub|IOData]) when is_list(Sub) ->
      [ioindent(Spacing, Sub)|ioindent(Spacing, IOData)];
  ioindent(Spacing, [10|IOData]) ->
      [10, Spacing|ioindent(Spacing, IOData)];
  ioindent(_Spacing, []) ->
      [];
  ioindent(Spacing, [Other|IOData]) ->
      [Other|ioindent(Spacing, IOData)].
  