[erlang-patches] [PATCH] Don't shorten error messages in Eunit Surefire reports

Niclas Axelsson burbas@REDACTED
Fri Feb 25 17:32:02 CET 2011


On 02/25/2011 12:03 PM, Magnus Henoch wrote:
> Currently, error messages in Eunit Surefire reports are shortened just
> like when written to a terminal.  However, the space limitations that
> constrain terminal output do not apply here, so it's more useful to
> include the unshortened error message.  Getting the full error
> message can be particularly helpful when an assertMatch fails because
> of a long and deep error term.
> ---
>   lib/eunit/src/eunit_surefire.erl |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl
> index eb994a9..e184df1 100644
> --- a/lib/eunit/src/eunit_surefire.erl
> +++ b/lib/eunit/src/eunit_surefire.erl
> @@ -323,7 +323,7 @@ write_testcase(
>   format_testcase_result(ok) ->  [<<>>];
>   format_testcase_result({failed, {error, {Type, _}, _} = Exception}) when is_atom(Type) ->
>       [?INDENT, ?INDENT,<<"<failure type=\"">>, escape_attr(atom_to_list(Type)),<<"\">">>, ?NEWLINE,
> -<<"::">>, escape_text(eunit_lib:format_exception(Exception)),
> +<<"::">>, escape_text(io_lib:format("~p", [Exception])),
>       ?INDENT, ?INDENT,<<"</failure>">>, ?NEWLINE];
>   format_testcase_result({failed, Term}) ->
>       [?INDENT, ?INDENT,<<"<failure type=\"unknown\">">>, ?NEWLINE,
> @@ -331,7 +331,7 @@ format_testcase_result({failed, Term}) ->
>       ?INDENT, ?INDENT,<<"</failure>">>, ?NEWLINE];
>   format_testcase_result({aborted, {Class, _Term, _Trace} = Exception}) when is_atom(Class) ->
>       [?INDENT, ?INDENT,<<"<error type=\"">>, escape_attr(atom_to_list(Class)),<<"\">">>, ?NEWLINE,
> -<<"::">>, escape_text(eunit_lib:format_exception(Exception)),
> +<<"::">>, escape_text(io_lib:format("~p", [Exception])),
>       ?INDENT, ?INDENT,<<"</error>">>, ?NEWLINE];
>   format_testcase_result({aborted, Term}) ->
>       [?INDENT, ?INDENT,<<"<error type=\"unknown\">">>, ?NEWLINE,
>    
Thanks Magnus,

Included in 'pu'.

Regards,
Niclas Axelsson, Erlang/OTP


More information about the erlang-patches mailing list