Support negative integers in modified annotations

This commit is contained in:
David Ansari 2024-10-11 14:43:31 +02:00
parent 2e90619a62
commit b1064fddba
2 changed files with 9 additions and 4 deletions

View File

@ -1178,8 +1178,13 @@ wrap_map_value(true) ->
{boolean, true};
wrap_map_value(false) ->
{boolean, false};
wrap_map_value(V) when is_integer(V) andalso V >= 0 ->
uint(V);
wrap_map_value(V) when is_integer(V) ->
case V < 0 of
true ->
{int, V};
false ->
uint(V)
end;
wrap_map_value(V) when is_binary(V) ->
utf8(V);
wrap_map_value(V) when is_list(V) ->

View File

@ -786,7 +786,7 @@ modified_dead_letter_history(Config) ->
#{<<"x-opt-history-list">> => {list, [{int, -99} | L1]},
<<"x-opt-history-map">> => {map, [{{symbol, <<"k2">>}, {symbol, <<"v2">>}} | L2]},
<<"x-opt-history-array">> => {array, utf8, [{utf8, <<"a2">>} | L0]},
<<"x-other">> => 99}}),
<<"x-other">> => -99}}),
{ok, Msg3} = amqp10_client:get_msg(Receiver1),
?assertEqual([<<"m">>], amqp10_msg:body(Msg3)),
@ -797,7 +797,7 @@ modified_dead_letter_history(Config) ->
<<"x-opt-history-list">> := [{int, -99}, {utf8, <<"l1">>}],
<<"x-opt-history-map">> := [{{symbol, <<"k2">>}, {symbol, <<"v2">>}},
{{symbol, <<"k1">>}, {byte, -1}}],
<<"x-other">> := 99}, amqp10_msg:message_annotations(Msg3)),
<<"x-other">> := -99}, amqp10_msg:message_annotations(Msg3)),
ok = amqp10_client:accept_msg(Receiver1, Msg3),
ok = detach_link_sync(Receiver1),