From 84c1a428add022aa775360c4dc93c04bb8cb2613 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Tue, 22 Aug 2017 16:21:21 +0200 Subject: eunit (test): Do not use deprecated functions in string(3) --- lib/eunit/src/eunit_lib.erl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/eunit') 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. %% --------------------------------------------------------------------- -- cgit v1.2.3