fix(emqx_logger_jsonfmt:best_effort_json_test): test cases
This commit is contained in:
parent
e3cb63f59a
commit
5e3de1a4e3
|
@ -452,19 +452,19 @@ best_effort_json_test() ->
|
||||||
),
|
),
|
||||||
%% List is IO Data
|
%% List is IO Data
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{<<"what">> => <<"hej\n">>},
|
#{<<"what">> := <<"hej\n">>},
|
||||||
emqx_utils_json:decode(emqx_logger_jsonfmt:best_effort_json(#{what => [<<"hej">>, 10]}))
|
emqx_utils_json:decode(emqx_logger_jsonfmt:best_effort_json(#{what => [<<"hej">>, 10]}))
|
||||||
),
|
),
|
||||||
%% Force list to be interpreted as an array
|
%% Force list to be interpreted as an array
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{<<"what">> => [<<"hej">>, 10]},
|
#{<<"what">> := [<<"hej">>, 10]},
|
||||||
emqx_utils_json:decode(
|
emqx_utils_json:decode(
|
||||||
emqx_logger_jsonfmt:best_effort_json(#{what => {'$array$', [<<"hej">>, 10]}})
|
emqx_logger_jsonfmt:best_effort_json(#{what => {'$array$', [<<"hej">>, 10]}})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
%% IO Data inside an array
|
%% IO Data inside an array
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{<<"what">> => [<<"hej">>, 10, <<"hej\n">>]},
|
#{<<"what">> := [<<"hej">>, 10, <<"hej\n">>]},
|
||||||
emqx_utils_json:decode(
|
emqx_utils_json:decode(
|
||||||
emqx_logger_jsonfmt:best_effort_json(#{
|
emqx_logger_jsonfmt:best_effort_json(#{
|
||||||
what => {'$array$', [<<"hej">>, 10, [<<"hej">>, 10]]}
|
what => {'$array$', [<<"hej">>, 10, [<<"hej">>, 10]]}
|
||||||
|
@ -473,7 +473,7 @@ best_effort_json_test() ->
|
||||||
),
|
),
|
||||||
%% Array inside an array
|
%% Array inside an array
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
#{<<"what">> => [<<"hej">>, 10, [<<"hej">>, 10]]},
|
#{<<"what">> := [<<"hej">>, 10, [<<"hej">>, 10]]},
|
||||||
emqx_utils_json:decode(
|
emqx_utils_json:decode(
|
||||||
emqx_logger_jsonfmt:best_effort_json(#{
|
emqx_logger_jsonfmt:best_effort_json(#{
|
||||||
what => {'$array$', [<<"hej">>, 10, {'$array$', [<<"hej">>, 10]}]}
|
what => {'$array$', [<<"hej">>, 10, {'$array$', [<<"hej">>, 10]}]}
|
||||||
|
|
Loading…
Reference in New Issue