fix(emqx_ctl): fix an error when "~" in the print content
This commit is contained in:
parent
835eb84b5d
commit
dba37513a1
|
@ -136,11 +136,11 @@ help() ->
|
|||
|
||||
-spec(print(io:format()) -> ok).
|
||||
print(Msg) ->
|
||||
io:format(format(Msg)).
|
||||
io:format("~s", [format(Msg)]).
|
||||
|
||||
-spec(print(io:format(), [term()]) -> ok).
|
||||
print(Format, Args) ->
|
||||
io:format(format(Format, Args)).
|
||||
io:format("~s", [format(Format, Args)]).
|
||||
|
||||
-spec(usage([cmd_usage()]) -> ok).
|
||||
usage(UsageList) ->
|
||||
|
|
|
@ -67,10 +67,12 @@ t_run_commands(_) ->
|
|||
t_print(_) ->
|
||||
ok = emqx_ctl:print("help"),
|
||||
ok = emqx_ctl:print("~s", [help]),
|
||||
ok = emqx_ctl:print("~s", [<<"~!@#$%^&*()">>]),
|
||||
% - check the output of the usage
|
||||
mock_print(),
|
||||
?assertEqual("help", emqx_ctl:print("help")),
|
||||
?assertEqual("help", emqx_ctl:print("~s", [help])),
|
||||
?assertEqual("~!@#$%^&*()", emqx_ctl:print("~s", [<<"~!@#$%^&*()">>])),
|
||||
unmock_print().
|
||||
|
||||
t_usage(_) ->
|
||||
|
|
Loading…
Reference in New Issue