Skip to content

Commit

Permalink
Adapt test to check for both local function ref formats
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-gonet committed Oct 24, 2024
1 parent 519b990 commit f054dfc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/erlang_tests/test_fun_info.erl
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ test_funs() ->

{module, test_fun_info} = erlang:fun_info(LocalFun, module),
{name, LocalFunName} = erlang:fun_info(LocalFun, name),
% e.g. -test_funs/0-fun-1-
true = atom_contains(LocalFunName, "test_funs"),
{arity, 1} = erlang:fun_info(LocalFun, arity),
{type, local} = erlang:fun_info(LocalFun, type),

{module, test_fun_info} = erlang:fun_info(LocalFunRef, module),
{name, LocalFunRefName} = erlang:fun_info(LocalFunRef, name),
true = atom_contains(LocalFunRefName, "f/3"),
% in older Erlang versions, the name was in generated name format
OldFormat = atom_contains(LocalFunRefName, "test_funs"),
NewFormat = LocalFunRefName == f,
true = OldFormat orelse NewFormat,
{arity, 3} = erlang:fun_info(LocalFunRef, arity),
{type, local} = erlang:fun_info(LocalFunRef, type),

Expand Down

0 comments on commit f054dfc

Please sign in to comment.