THRIFT-5635 Update erlang client for Erlang 23-25
Client: erl
Patch: Sergey Yelin
This closes #2677
Summary of changes:
- Add useful compiler options
- Format sources using erlfmt
- Switch to modern callbacks in thrift_* modules
- Add static analysis (dialyzer), disabled by default
- Add/fix types for API calls
NOTE: Enabling static analysis requires additional tweaks in multiplexer module.
diff --git a/lib/erl/test/test_const.erl b/lib/erl/test/test_const.erl
index 627777b..74830e9 100644
--- a/lib/erl/test/test_const.erl
+++ b/lib/erl/test/test_const.erl
@@ -25,30 +25,31 @@
-include("gen-erl/constants_demo_types.hrl").
namespace_test() ->
- %% Verify that records produced by ConstantsDemo.thrift have the right namespace.
- io:format(user, "in namespace_test()\n", []),
- {struct, _} = constants_demo_types:struct_info('consts_thing'),
- {struct, _} = constants_demo_types:struct_info('consts_Blah'),
- ok.
+ %% Verify that records produced by ConstantsDemo.thrift have the right namespace.
+ io:format(user, "in namespace_test()\n", []),
+ {struct, _} = constants_demo_types:struct_info('consts_thing'),
+ {struct, _} = constants_demo_types:struct_info('consts_Blah'),
+ ok.
const_map_test() ->
- ?assertEqual(233, constants_demo_constants:gen_map(35532)),
- ?assertError(function_clause, constants_demo_constants:gen_map(0)),
+ ?assertEqual(233, constants_demo_constants:gen_map(35532)),
+ ?assertError(function_clause, constants_demo_constants:gen_map(0)),
- ?assertEqual(853, constants_demo_constants:gen_map(43523, default)),
- ?assertEqual(default, constants_demo_constants:gen_map(10110, default)),
+ ?assertEqual(853, constants_demo_constants:gen_map(43523, default)),
+ ?assertEqual(default, constants_demo_constants:gen_map(10110, default)),
- ?assertEqual(98325, constants_demo_constants:gen_map2("lkjsdf")),
- ?assertError(function_clause, constants_demo_constants:gen_map2("nonexist")),
+ ?assertEqual(98325, constants_demo_constants:gen_map2("lkjsdf")),
+ ?assertError(function_clause, constants_demo_constants:gen_map2("nonexist")),
- ?assertEqual(233, constants_demo_constants:gen_map2("hello", 321)),
- ?assertEqual(321, constants_demo_constants:gen_map2("goodbye", 321)).
+ ?assertEqual(233, constants_demo_constants:gen_map2("hello", 321)),
+ ?assertEqual(321, constants_demo_constants:gen_map2("goodbye", 321)).
const_list_test() ->
- ?assertEqual(23598352, constants_demo_constants:gen_list(2)),
- ?assertError(function_clause, constants_demo_constants:gen_list(0)),
+ ?assertEqual(23598352, constants_demo_constants:gen_list(2)),
+ ?assertError(function_clause, constants_demo_constants:gen_list(0)),
- ?assertEqual(3253523, constants_demo_constants:gen_list(3, default)),
- ?assertEqual(default, constants_demo_constants:gen_list(10, default)).
+ ?assertEqual(3253523, constants_demo_constants:gen_list(3, default)),
+ ?assertEqual(default, constants_demo_constants:gen_list(10, default)).
--endif. %% TEST
+%% TEST
+-endif.