mirror of
https://github.com/valitydev/msgpack-erlang.git
synced 2024-11-06 08:45:19 +00:00
Merge pull request #40 from bb4242/master
Allow packing maps even when {format,map} is not set.
This commit is contained in:
commit
b59e14411e
@ -122,7 +122,7 @@ handle_binary(Bin, Opt) ->
|
||||
end.
|
||||
|
||||
%% %% map interface
|
||||
handle_ext(Map, Opt = ?OPTION{interface=map}) when is_map(Map) ->
|
||||
handle_ext(Map, Opt) when is_map(Map) ->
|
||||
pack_map(maps:to_list(Map), Opt);
|
||||
|
||||
handle_ext(Any, _Opt = ?OPTION{ext_packer=Packer,
|
||||
|
@ -237,6 +237,13 @@ map_test_()->
|
||||
?assertEqual(BinaryJSX, Binary)
|
||||
end},
|
||||
|
||||
{"pack map without {format,map}",
|
||||
fun() ->
|
||||
Map = maps:from_list([ {X, X * 2} || X <- lists:seq(0, 16) ]),
|
||||
Binary = pack(Map),
|
||||
?assertEqual({ok,Map}, unpack(Binary, [{format,map}]))
|
||||
end},
|
||||
|
||||
{"map length 16",
|
||||
fun() ->
|
||||
Map = maps:from_list([ {X, X * 2} || X <- lists:seq(0, 16) ]),
|
||||
|
Loading…
Reference in New Issue
Block a user