From 5e3de1a4e3f204a45e4df7f4355307796a51087d Mon Sep 17 00:00:00 2001 From: Kjell Winblad Date: Tue, 28 May 2024 17:15:32 +0200 Subject: [PATCH] fix(emqx_logger_jsonfmt:best_effort_json_test): test cases --- apps/emqx/src/emqx_logger_jsonfmt.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/emqx/src/emqx_logger_jsonfmt.erl b/apps/emqx/src/emqx_logger_jsonfmt.erl index 33763418c..d8dcc77dc 100644 --- a/apps/emqx/src/emqx_logger_jsonfmt.erl +++ b/apps/emqx/src/emqx_logger_jsonfmt.erl @@ -452,19 +452,19 @@ best_effort_json_test() -> ), %% List is IO Data ?assertMatch( - #{<<"what">> => <<"hej\n">>}, + #{<<"what">> := <<"hej\n">>}, emqx_utils_json:decode(emqx_logger_jsonfmt:best_effort_json(#{what => [<<"hej">>, 10]})) ), %% Force list to be interpreted as an array ?assertMatch( - #{<<"what">> => [<<"hej">>, 10]}, + #{<<"what">> := [<<"hej">>, 10]}, emqx_utils_json:decode( emqx_logger_jsonfmt:best_effort_json(#{what => {'$array$', [<<"hej">>, 10]}}) ) ), %% IO Data inside an array ?assertMatch( - #{<<"what">> => [<<"hej">>, 10, <<"hej\n">>]}, + #{<<"what">> := [<<"hej">>, 10, <<"hej\n">>]}, emqx_utils_json:decode( emqx_logger_jsonfmt:best_effort_json(#{ what => {'$array$', [<<"hej">>, 10, [<<"hej">>, 10]]} @@ -473,7 +473,7 @@ best_effort_json_test() -> ), %% Array inside an array ?assertMatch( - #{<<"what">> => [<<"hej">>, 10, [<<"hej">>, 10]]}, + #{<<"what">> := [<<"hej">>, 10, [<<"hej">>, 10]]}, emqx_utils_json:decode( emqx_logger_jsonfmt:best_effort_json(#{ what => {'$array$', [<<"hej">>, 10, {'$array$', [<<"hej">>, 10]}]}