summaryrefslogtreecommitdiff
path: root/lib/eunit
diff options
context:
space:
mode:
authorDan Gudmundsson <dgud@erlang.org>2017-08-22 16:21:21 +0200
committerSiri Hansen <siri@erlang.org>2017-09-15 17:07:52 +0200
commit84c1a428add022aa775360c4dc93c04bb8cb2613 (patch)
tree2c9ec84e9d002e20da959629d38e33d553377bda /lib/eunit
parentedfb0fb05dc8f10b603ef79c49b4f6e8c01ec5b3 (diff)
downloaderlang-84c1a428add022aa775360c4dc93c04bb8cb2613.tar.gz
eunit (test): Do not use deprecated functions in string(3)
Diffstat (limited to 'lib/eunit')
-rw-r--r--lib/eunit/src/eunit_lib.erl9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/eunit/src/eunit_lib.erl b/lib/eunit/src/eunit_lib.erl
index aa2cffc66d..33088f4e0f 100644
--- a/lib/eunit/src/eunit_lib.erl
+++ b/lib/eunit/src/eunit_lib.erl
@@ -385,15 +385,14 @@ fun_parent(F) ->
{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))}
+ [Func, Rest] = string:split(S, "/"),
+ [FuncArg,_] = string:split(Rest, "-"),
+ {M, list_to_atom(Func), list_to_integer(FuncArg)}
end.
-ifdef(TEST).
fun_parent_test() ->
- {?MODULE,fun_parent_test,0} = fun_parent(fun () -> ok end).
+ {?MODULE,fun_parent_test,0} = fun_parent(fun (A) -> {ok,A} end).
-endif.
%% ---------------------------------------------------------------------