diff --git a/apps/emqx/src/emqx_ctl.erl b/apps/emqx/src/emqx_ctl.erl index 74b72c193..0bfa17350 100644 --- a/apps/emqx/src/emqx_ctl.erl +++ b/apps/emqx/src/emqx_ctl.erl @@ -42,8 +42,7 @@ ]). %% Exports mainly for test cases --export([ format/1 - , format/2 +-export([ format/2 , format_usage/1 , format_usage/2 ]). @@ -139,7 +138,7 @@ help() -> -spec(print(io:format()) -> ok). print(Msg) -> - io:format("~ts", [format(Msg)]). + io:format("~ts", [format(Msg, [])]). -spec(print(io:format(), [term()]) -> ok). print(Format, Args) -> @@ -153,10 +152,6 @@ usage(UsageList) -> usage(CmdParams, Desc) -> io:format(format_usage(CmdParams, Desc)). --spec(format(io:format()) -> string()). -format(Msg) -> - lists:flatten(io_lib:format("~ts", [Msg])). - -spec(format(io:format(), [term()]) -> string()). format(Format, Args) -> lists:flatten(io_lib:format(Format, Args)). @@ -243,4 +238,3 @@ zip_cmd([X | Xs], [Y | Ys]) -> [{X, Y} | zip_cmd(Xs, Ys)]; zip_cmd([X | Xs], []) -> [{X, ""} | zip_cmd(Xs, [])]; zip_cmd([], [Y | Ys]) -> [{"", Y} | zip_cmd([], Ys)]; zip_cmd([], []) -> []. - diff --git a/apps/emqx/test/emqx_ctl_SUITE.erl b/apps/emqx/test/emqx_ctl_SUITE.erl index cebcd15e0..e56237d09 100644 --- a/apps/emqx/test/emqx_ctl_SUITE.erl +++ b/apps/emqx/test/emqx_ctl_SUITE.erl @@ -110,7 +110,7 @@ mock_print() -> %% proxy usage/1,2 and print/1,2 to format_xx/1,2 funcs catch meck:unload(emqx_ctl), meck:new(emqx_ctl, [non_strict, passthrough]), - meck:expect(emqx_ctl, print, fun(Arg) -> emqx_ctl:format(Arg) end), + meck:expect(emqx_ctl, print, fun(Arg) -> emqx_ctl:format(Arg, []) end), meck:expect(emqx_ctl, print, fun(Msg, Arg) -> emqx_ctl:format(Msg, Arg) end), meck:expect(emqx_ctl, usage, fun(Usages) -> emqx_ctl:format_usage(Usages) end), meck:expect(emqx_ctl, usage, fun(CmdParams, CmdDescr) -> diff --git a/apps/emqx_gateway/test/emqx_gateway_cli_SUITE.erl b/apps/emqx_gateway/test/emqx_gateway_cli_SUITE.erl index 95d97a8c5..bf1108c61 100644 --- a/apps/emqx_gateway/test/emqx_gateway_cli_SUITE.erl +++ b/apps/emqx_gateway/test/emqx_gateway_cli_SUITE.erl @@ -69,7 +69,7 @@ init_per_testcase(_, Conf) -> fun(L) -> emqx_ctl:format_usage(L) end), ok = meck:expect(emqx_ctl, print, fun(Fmt) -> - Self ! {fmt, emqx_ctl:format(Fmt)} + Self ! {fmt, emqx_ctl:format(Fmt, [])} end), ok = meck:expect(emqx_ctl, print, fun(Fmt, Args) ->