diff options
Diffstat (limited to 'lib/eunit/src')
-rw-r--r-- | lib/eunit/src/eunit_lib.erl | 22 | ||||
-rw-r--r-- | lib/eunit/src/eunit_tty.erl | 2 |
2 files changed, 11 insertions, 13 deletions
diff --git a/lib/eunit/src/eunit_lib.erl b/lib/eunit/src/eunit_lib.erl index aa2cffc66d..e340f50a3c 100644 --- a/lib/eunit/src/eunit_lib.erl +++ b/lib/eunit/src/eunit_lib.erl @@ -107,7 +107,7 @@ format_stacktrace(Trace) -> format_stacktrace(Trace, "in function", "in call from"). format_stacktrace([{M,F,A,L}|Fs], Pre, Pre1) when is_integer(A) -> - [io_lib:fwrite("~ts ~w:~w/~w~ts\n", + [io_lib:fwrite("~ts ~w:~tw/~w~ts\n", [Pre, M, F, A, format_stacktrace_location(L)]) | format_stacktrace(Fs, Pre1, Pre1)]; format_stacktrace([{M,F,As,L}|Fs], Pre, Pre1) when is_list(As) -> @@ -121,9 +121,9 @@ format_stacktrace([{M,F,As,L}|Fs], Pre, Pre1) when is_list(As) -> io_lib:fwrite("~ts ~ts ~ts", [format_arg(A1),F,format_arg(A2)]); false -> - io_lib:fwrite("~w(~ts)", [F,format_arglist(As)]) + io_lib:fwrite("~tw(~ts)", [F,format_arglist(As)]) end, - [io_lib:fwrite("~ts ~w:~w/~w~ts\n called as ~ts\n", + [io_lib:fwrite("~ts ~w:~tw/~w~ts\n called as ~ts\n", [Pre,M,F,A,format_stacktrace_location(L),C]) | format_stacktrace(Fs,Pre1,Pre1)]; format_stacktrace([{M,F,As}|Fs], Pre, Pre1) -> @@ -162,15 +162,15 @@ is_op(_M, _F, _A) -> format_error({bad_test, Term}) -> error_msg("bad test descriptor", "~tP", [Term, 15]); format_error({bad_generator, {{M,F,A}, Term}}) -> - error_msg(io_lib:format("result from generator ~w:~w/~w is not a test", + error_msg(io_lib:format("result from generator ~w:~tw/~w is not a test", [M,F,A]), "~tP", [Term, 15]); format_error({generator_failed, {{M,F,A}, Exception}}) -> - error_msg(io_lib:format("test generator ~w:~w/~w failed",[M,F,A]), + error_msg(io_lib:format("test generator ~w:~tw/~w failed",[M,F,A]), "~ts", [format_exception(Exception)]); format_error({no_such_function, {M,F,A}}) when is_atom(M), is_atom(F), is_integer(A) -> - error_msg(io_lib:format("no such function: ~w:~w/~w", [M,F,A]), + error_msg(io_lib:format("no such function: ~w:~tw/~w", [M,F,A]), "", []); format_error({module_not_found, M}) -> error_msg("test module not found", "~tp", [M]); @@ -185,7 +185,7 @@ format_error({cleanup_failed, Exception}) -> error_msg("context cleanup failed", "~ts", [format_exception(Exception)]); format_error({{bad_instantiator, {{M,F,A}, Term}}, _DummyException}) -> - error_msg(io_lib:format("result from instantiator ~w:~w/~w is not a test", + error_msg(io_lib:format("result from instantiator ~w:~tw/~w is not a test", [M,F,A]), "~tP", [Term, 15]); format_error({instantiation_failed, Exception}) -> @@ -384,11 +384,9 @@ fun_parent(F) -> {arity, A} = erlang:fun_info(F, arity), {M, N, A}; {type, local} -> - [$-|S] = atom_to_list(N), - C1 = string:chr(S, $/), - C2 = string:chr(S, $-), - {M, list_to_atom(string:sub_string(S, 1, C1 - 1)), - list_to_integer(string:sub_string(S, C1 + 1, C2 - 1))} + [$-|S] = atom_to_list(N), + [S2, T] = string:split(S, "/", trailing), + {M, list_to_atom(S2), element(1, string:to_integer(T))} end. -ifdef(TEST). diff --git a/lib/eunit/src/eunit_tty.erl b/lib/eunit/src/eunit_tty.erl index 77a7cf1fd5..2c9a598628 100644 --- a/lib/eunit/src/eunit_tty.erl +++ b/lib/eunit/src/eunit_tty.erl @@ -235,7 +235,7 @@ print_test_error({skipped, Reason}, _) -> format_skipped({module_not_found, M}) -> io_lib:fwrite("missing module: ~w", [M]); format_skipped({no_such_function, {M,F,A}}) -> - io_lib:fwrite("no such function: ~w:~w/~w", [M,F,A]). + io_lib:fwrite("no such function: ~w:~tw/~w", [M,F,A]). print_test_cancel(Reason) -> fwrite(format_cancel(Reason)). |