From d53be747c945d5e86997e1944446795b271dacb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 11 Mar 2011 17:34:22 +0100 Subject: Update copyright years --- lib/eunit/doc/src/book.xml | 2 +- lib/eunit/doc/src/notes.xml | 2 +- lib/eunit/doc/src/part.xml | 2 +- lib/eunit/doc/src/part_notes.xml | 2 +- lib/eunit/doc/src/ref_man.xml | 2 +- lib/eunit/test/eunit_SUITE.erl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/eunit') diff --git a/lib/eunit/doc/src/book.xml b/lib/eunit/doc/src/book.xml index 4444b1dd7a..eb044c1a66 100644 --- a/lib/eunit/doc/src/book.xml +++ b/lib/eunit/doc/src/book.xml @@ -5,7 +5,7 @@
2008 - 2008 + 2011 Ericsson AB, All Rights Reserved diff --git a/lib/eunit/doc/src/notes.xml b/lib/eunit/doc/src/notes.xml index 1717dd7988..a9960153e5 100644 --- a/lib/eunit/doc/src/notes.xml +++ b/lib/eunit/doc/src/notes.xml @@ -5,7 +5,7 @@
2008 - 2008 + 2011 Ericsson AB, All Rights Reserved diff --git a/lib/eunit/doc/src/part.xml b/lib/eunit/doc/src/part.xml index e31a8d1b78..84e5aec039 100644 --- a/lib/eunit/doc/src/part.xml +++ b/lib/eunit/doc/src/part.xml @@ -5,7 +5,7 @@
2008 - 2008 + 2011 Ericsson AB, All Rights Reserved diff --git a/lib/eunit/doc/src/part_notes.xml b/lib/eunit/doc/src/part_notes.xml index 28644f961b..191d69b915 100644 --- a/lib/eunit/doc/src/part_notes.xml +++ b/lib/eunit/doc/src/part_notes.xml @@ -5,7 +5,7 @@
2008 - 2008 + 2011 Ericsson AB, All Rights Reserved diff --git a/lib/eunit/doc/src/ref_man.xml b/lib/eunit/doc/src/ref_man.xml index 02feef5e97..eb46ceda1e 100644 --- a/lib/eunit/doc/src/ref_man.xml +++ b/lib/eunit/doc/src/ref_man.xml @@ -5,7 +5,7 @@
2008 - 2008 + 2011 Ericsson AB, All Rights Reserved diff --git a/lib/eunit/test/eunit_SUITE.erl b/lib/eunit/test/eunit_SUITE.erl index 0f57905d17..47c2435d63 100644 --- a/lib/eunit/test/eunit_SUITE.erl +++ b/lib/eunit/test/eunit_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010. All Rights Reserved. +%% Copyright Ericsson AB 2010-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in -- cgit v1.2.3 From b6decafc7a45e7519dd53d1956909463a06d3f6a Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Thu, 7 Apr 2011 15:37:28 +0100 Subject: Increase depth of error messages in Eunit Surefire reports 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 more of the error message. Getting the full error message can be particularly helpful when an assertMatch fails because of a long and deep error term. The new depth of 100 should be enough for most cases, while protecting against runaway errors. --- lib/eunit/src/eunit_lib.erl | 18 ++++++++++-------- lib/eunit/src/eunit_surefire.erl | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/eunit') diff --git a/lib/eunit/src/eunit_lib.erl b/lib/eunit/src/eunit_lib.erl index 4751f1094a..45d2387e7b 100644 --- a/lib/eunit/src/eunit_lib.erl +++ b/lib/eunit/src/eunit_lib.erl @@ -33,7 +33,7 @@ -export([dlist_next/1, uniq/1, fun_parent/1, is_string/1, command/1, command/2, command/3, trie_new/0, trie_store/2, trie_match/2, split_node/1, consult_file/1, list_dir/1, format_exit_term/1, - format_exception/1, format_error/1]). + format_exception/1, format_exception/2, format_error/1]). %% Type definitions for describing exceptions @@ -55,21 +55,23 @@ %% --------------------------------------------------------------------- %% Formatting of error descriptors +format_exception(Exception) -> + format_exception(Exception, 20). -format_exception({Class,Term,Trace}) +format_exception({Class,Term,Trace}, Depth) when is_atom(Class), is_list(Trace) -> case is_stacktrace(Trace) of true -> io_lib:format("~w:~P\n~s", - [Class, Term, 20, format_stacktrace(Trace)]); + [Class, Term, Depth, format_stacktrace(Trace)]); false -> - format_term(Term) + format_term(Term, Depth) end; -format_exception(Term) -> - format_term(Term). +format_exception(Term, Depth) -> + format_term(Term, Depth). -format_term(Term) -> - io_lib:format("~P\n", [Term, 15]). +format_term(Term, Depth) -> + io_lib:format("~P\n", [Term, Depth]). format_exit_term(Term) -> {Reason, Trace} = analyze_exit_term(Term), diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl index eb994a990a..f289cd724a 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, <<">, escape_attr(atom_to_list(Type)), <<"\">">>, ?NEWLINE, - <<"::">>, escape_text(eunit_lib:format_exception(Exception)), + <<"::">>, escape_text(eunit_lib:format_exception(Exception, 100)), ?INDENT, ?INDENT, <<"">>, ?NEWLINE]; format_testcase_result({failed, Term}) -> [?INDENT, ?INDENT, <<"">>, ?NEWLINE, @@ -331,7 +331,7 @@ format_testcase_result({failed, Term}) -> ?INDENT, ?INDENT, <<"">>, ?NEWLINE]; format_testcase_result({aborted, {Class, _Term, _Trace} = Exception}) when is_atom(Class) -> [?INDENT, ?INDENT, <<">, escape_attr(atom_to_list(Class)), <<"\">">>, ?NEWLINE, - <<"::">>, escape_text(eunit_lib:format_exception(Exception)), + <<"::">>, escape_text(eunit_lib:format_exception(Exception, 100)), ?INDENT, ?INDENT, <<"">>, ?NEWLINE]; format_testcase_result({aborted, Term}) -> [?INDENT, ?INDENT, <<"">>, ?NEWLINE, -- cgit v1.2.3